Commit 33d53e1f by 罗翻

处理工单前增加活体检测

parent d46bcf9d
Showing with 1377 additions and 365 deletions
...@@ -379,7 +379,7 @@ public class LivenessActivity extends Activity ...@@ -379,7 +379,7 @@ public class LivenessActivity extends Activity
/** /**
* 跳转Activity传递信息 * 跳转Activity传递信息
*/ */
private void handleResult(final int resID, String delta, Map<String, byte[]> images) { public void handleResult(final int resID, String delta, Map<String, byte[]> images) {
String resultString = getResources().getString(resID); String resultString = getResources().getString(resID);
try { try {
jsonObject.put("result", resultString); jsonObject.put("result", resultString);
......
...@@ -22,156 +22,160 @@ import java.util.HashMap; ...@@ -22,156 +22,160 @@ import java.util.HashMap;
*/ */
public class IDetection { public class IDetection {
private View rootView; private View rootView;
private Context mContext; private Context mContext;
public View[] mAnimViews; public View[] mAnimViews;
private int num = 3;// 动作数量 private int num = 3;// 动作数量
private HashMap<Integer, Drawable> mDrawableCache; private HashMap<Integer, Drawable> mDrawableCache;
public int mCurShowIndex = -1;// 现在底部展示试图的索引值 public int mCurShowIndex = -1;// 现在底部展示试图的索引值
public ArrayList<Detector.DetectionType> mDetectionSteps;// 活体检测动作列表 public ArrayList<Detector.DetectionType> mDetectionSteps;// 活体检测动作列表
public IDetection(Context mContext, View view) { public IDetection(Context mContext, View view) {
this.mContext = mContext; this.mContext = mContext;
this.rootView = view; this.rootView = view;
mDrawableCache = new HashMap<Integer, Drawable>(); mDrawableCache = new HashMap<Integer, Drawable>();
} }
public void animationInit() { public void animationInit() {
int[] reses = { R.drawable.liveness_head_pitch, R.drawable.liveness_head_yaw, int[] reses = {R.drawable.liveness_head_pitch, R.drawable.liveness_head_yaw,
R.drawable.liveness_mouth_open_closed, R.drawable.liveness_eye_open_closed }; R.drawable.liveness_mouth_open_closed, R.drawable.liveness_eye_open_closed};
for (int oneRes : reses) { for (int oneRes : reses) {
mDrawableCache.put(oneRes, (mContext.getResources().getDrawable(oneRes))); mDrawableCache.put(oneRes, (mContext.getResources().getDrawable(oneRes)));
} }
} }
public void viewsInit() { public void viewsInit() {
mAnimViews = new View[2]; mAnimViews = new View[2];
mAnimViews[0] = (rootView.findViewById(R.id.liveness_layout_first_layout)); mAnimViews[0] = (rootView.findViewById(R.id.liveness_layout_first_layout));
mAnimViews[1] = (rootView.findViewById(R.id.liveness_layout_second_layout)); mAnimViews[1] = (rootView.findViewById(R.id.liveness_layout_second_layout));
for (View tmpView : mAnimViews) { for (View tmpView : mAnimViews) {
tmpView.setVisibility(View.INVISIBLE); tmpView.setVisibility(View.INVISIBLE);
} }
} }
public void changeType(final Detector.DetectionType detectiontype, long timeout) { public void changeType(final Detector.DetectionType detectiontype, long timeout) {
Animation animationIN = AnimationUtils.loadAnimation(mContext, R.anim.liveness_rightin); Animation animationIN = AnimationUtils.loadAnimation(mContext, R.anim.liveness_rightin);
Animation animationOut = AnimationUtils.loadAnimation(mContext, R.anim.liveness_leftout); Animation animationOut = AnimationUtils.loadAnimation(mContext, R.anim.liveness_leftout);
if (mCurShowIndex != -1) // 已经存在layout 需要移除之 if (mCurShowIndex != -1) // 已经存在layout 需要移除之
{ {
mAnimViews[mCurShowIndex].setVisibility(View.INVISIBLE); mAnimViews[mCurShowIndex].setVisibility(View.INVISIBLE);
mAnimViews[mCurShowIndex].setAnimation(animationOut); mAnimViews[mCurShowIndex].setAnimation(animationOut);
} else { } else {
mAnimViews[0].setVisibility(View.INVISIBLE); mAnimViews[0].setVisibility(View.INVISIBLE);
mAnimViews[0].startAnimation(animationOut); mAnimViews[0].startAnimation(animationOut);
} }
mCurShowIndex = mCurShowIndex == -1 ? 0 : (mCurShowIndex == 0 ? 1 : 0); mCurShowIndex = mCurShowIndex == -1 ? 0 : (mCurShowIndex == 0 ? 1 : 0);
initAnim(detectiontype, mAnimViews[mCurShowIndex]); initAnim(detectiontype, mAnimViews[mCurShowIndex]);
mAnimViews[mCurShowIndex].setVisibility(View.VISIBLE); mAnimViews[mCurShowIndex].setVisibility(View.VISIBLE);
mAnimViews[mCurShowIndex].startAnimation(animationIN); mAnimViews[mCurShowIndex].startAnimation(animationIN);
} }
TextView detectionNameText; TextView detectionNameText;
String detectionNameStr; String detectionNameStr;
private void initAnim(Detector.DetectionType detectiontype, View layoutView) { private void initAnim(Detector.DetectionType detectiontype, View layoutView) {
ImageView tmpImageView = (ImageView) layoutView.findViewById(R.id.detection_step_image); ImageView tmpImageView = (ImageView) layoutView.findViewById(R.id.detection_step_image);
tmpImageView.setImageDrawable(getDrawRes(detectiontype)); tmpImageView.setImageDrawable(getDrawRes(detectiontype));
((AnimationDrawable) tmpImageView.getDrawable()).start(); ((AnimationDrawable) tmpImageView.getDrawable()).start();
detectionNameText = (TextView) layoutView.findViewById(R.id.detection_step_name); detectionNameText = (TextView) layoutView.findViewById(R.id.detection_step_name);
detectionNameStr = getDetectionName(detectiontype); detectionNameStr = getDetectionName(detectiontype);
detectionNameText.setText(detectionNameStr); detectionNameText.setText(detectionNameStr);
} }
public void checkFaceTooLarge(boolean isLarge) { public void checkFaceTooLarge(boolean isLarge) {
if (detectionNameStr != null && detectionNameText != null) { if (detectionNameStr != null && detectionNameText != null) {
if (isLarge && !detectionNameText.getText().toString().equals(mContext.getString(R.string.face_too_large))) { if (isLarge && !detectionNameText.getText().toString().equals(mContext.getString(R.string.face_too_large))) {
detectionNameText.setText(R.string.face_too_large); detectionNameText.setText(R.string.face_too_large);
} else if(!isLarge && detectionNameText.getText().toString().equals(mContext.getString(R.string.face_too_large))){ } else if (!isLarge && detectionNameText.getText().toString().equals(mContext.getString(R.string.face_too_large))) {
detectionNameText.setText(detectionNameStr); detectionNameText.setText(detectionNameStr);
} }
} }
} }
private Drawable getDrawRes(Detector.DetectionType detectionType) { private Drawable getDrawRes(Detector.DetectionType detectionType) {
int resID = -1; int resID = -1;
switch (detectionType) { switch (detectionType) {
case POS_PITCH: case POS_PITCH:
case POS_PITCH_UP: case POS_PITCH_UP:
case POS_PITCH_DOWN: case POS_PITCH_DOWN:
resID = R.drawable.liveness_head_pitch; resID = R.drawable.liveness_head_pitch;
break; break;
case POS_YAW_LEFT: case POS_YAW_LEFT:
case POS_YAW_RIGHT: case POS_YAW_RIGHT:
case POS_YAW: case POS_YAW:
resID = R.drawable.liveness_head_yaw; resID = R.drawable.liveness_head_yaw;
break; break;
case MOUTH: case MOUTH:
resID = R.drawable.liveness_mouth_open_closed; resID = R.drawable.liveness_mouth_open_closed;
break; break;
case BLINK: case BLINK:
resID = R.drawable.liveness_eye_open_closed; resID = R.drawable.liveness_eye_open_closed;
break; break;
} }
Drawable cachedDrawAble = mDrawableCache.get(resID); Drawable cachedDrawAble = mDrawableCache.get(resID);
if (cachedDrawAble != null) if (cachedDrawAble != null)
return cachedDrawAble; return cachedDrawAble;
else { else {
Drawable drawable = mContext.getResources().getDrawable(resID); Drawable drawable = mContext.getResources().getDrawable(resID);
mDrawableCache.put(resID, (drawable)); mDrawableCache.put(resID, (drawable));
return drawable; return drawable;
} }
} }
private String getDetectionName(Detector.DetectionType detectionType) { private String getDetectionName(Detector.DetectionType detectionType) {
String detectionName = null; String detectionName = null;
switch (detectionType) { switch (detectionType) {
case POS_PITCH: case POS_PITCH:
detectionName = mContext.getString(R.string.meglive_pitch); detectionName = mContext.getString(R.string.meglive_pitch);
break; break;
case POS_YAW: case POS_YAW:
detectionName = mContext.getString(R.string.meglive_yaw); detectionName = mContext.getString(R.string.meglive_yaw);
break; break;
case MOUTH: case MOUTH:
detectionName = mContext.getString(R.string.meglive_mouth_open_closed); detectionName = mContext.getString(R.string.meglive_mouth_open_closed);
break; break;
case BLINK: case BLINK:
detectionName = mContext.getString(R.string.meglive_eye_open_closed); detectionName = mContext.getString(R.string.meglive_eye_open_closed);
break; break;
case POS_YAW_LEFT: case POS_YAW_LEFT:
detectionName = mContext.getString(R.string.meglive_pos_yaw_left); detectionName = mContext.getString(R.string.meglive_pos_yaw_left);
break; break;
case POS_YAW_RIGHT: case POS_YAW_RIGHT:
detectionName = mContext.getString(R.string.meglive_pos_yaw_right); detectionName = mContext.getString(R.string.meglive_pos_yaw_right);
break; break;
} }
return detectionName; return detectionName;
} }
/** public void setNum(int n) {
* 初始化检测动作 num = n;
*/ }
public void detectionTypeInit() {
ArrayList<DetectionType> tmpTypes = new ArrayList<Detector.DetectionType>(); /**
tmpTypes.add(Detector.DetectionType.BLINK);// 眨眼 * 初始化检测动作
tmpTypes.add(Detector.DetectionType.MOUTH);// 张嘴 */
tmpTypes.add(Detector.DetectionType.POS_PITCH);// 缓慢点头 public void detectionTypeInit() {
tmpTypes.add(Detector.DetectionType.POS_YAW);// 左右摇头 ArrayList<DetectionType> tmpTypes = new ArrayList<>();
Collections.shuffle(tmpTypes);// 打乱顺序 tmpTypes.add(Detector.DetectionType.BLINK);// 眨眼
mDetectionSteps = new ArrayList<DetectionType>(num); tmpTypes.add(Detector.DetectionType.MOUTH);// 张嘴
for (int i = 0; i < num; i++) { tmpTypes.add(Detector.DetectionType.POS_PITCH);// 缓慢点头
mDetectionSteps.add(tmpTypes.get(i)); tmpTypes.add(Detector.DetectionType.POS_YAW);// 左右摇头
} Collections.shuffle(tmpTypes);// 打乱顺序
} mDetectionSteps = new ArrayList<>(num);
for (int i = 0; i < num; i++) {
public void onDestroy() { mDetectionSteps.add(tmpTypes.get(i));
rootView = null; }
mContext = null; }
if (mDrawableCache != null) {
mDrawableCache.clear(); public void onDestroy() {
} rootView = null;
} mContext = null;
if (mDrawableCache != null) {
mDrawableCache.clear();
}
}
} }
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <layout>
android:id="@+id/liveness_layout_rootRel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextureView
android:id="@+id/liveness_layout_textureview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.megvii.idcardlib.view.AutoRatioImageview
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/liveness_layout_camera_mask" />
<com.megvii.idcardlib.FaceMask
android:id="@+id/liveness_layout_facemask"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<com.megvii.idcardlib.view.AutoRatioImageview
android:id="@+id/liveness_layout_head_mask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="@drawable/liveness_layout_head_mask" />
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/liveness_layout_rootRel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/liveness_layout_head_mask" android:orientation="vertical">
android:background="#F6F5F4" >
<include <TextureView
android:id="@+id/activity_main_bottomTitle" android:id="@+id/liveness_layout_textureview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dip" android:layout_height="match_parent" />
android:layout_alignParentBottom="true"
layout="@layout/bottom_title_layout" />
<include <com.megvii.idcardlib.view.AutoRatioImageview
android:id="@+id/liveness_layout_first_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/activity_main_bottomTitle" android:src="@drawable/liveness_layout_camera_mask" />
android:layout_marginBottom="15dip"
android:layout_marginTop="15dip"
layout="@layout/liveness_detection_step"
android:visibility="invisible" />
<include <com.megvii.idcardlib.FaceMask
android:id="@+id/liveness_layout_second_layout" android:id="@+id/liveness_layout_facemask"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_above="@+id/activity_main_bottomTitle"
android:layout_marginBottom="15dip"
android:layout_marginTop="15dip"
layout="@layout/liveness_detection_step"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <com.megvii.idcardlib.view.AutoRatioImageview
android:id="@+id/liveness_layout_bottom_tips_head" android:id="@+id/liveness_layout_head_mask"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/activity_main_bottomTitle"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:gravity="center" android:src="@drawable/liveness_layout_head_mask" />
android:orientation="vertical"
android:visibility="visible" > <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/liveness_layout_head_mask"
android:background="#F6F5F4">
<include
android:id="@+id/activity_main_bottomTitle"
layout="@layout/bottom_title_layout"
android:layout_width="match_parent"
android:layout_height="40dip"
android:layout_alignParentBottom="true"
android:visibility="gone" />
<TextView <include
android:id="@+id/liveness_layout_promptText" android:id="@+id/liveness_layout_first_layout"
android:layout_width="wrap_content" layout="@layout/liveness_detection_step"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/activity_main_bottomTitle"
android:layout_marginBottom="15dip"
android:layout_marginTop="15dip"
android:visibility="invisible" />
<include
android:id="@+id/liveness_layout_second_layout"
layout="@layout/liveness_detection_step"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dip" android:layout_above="@+id/activity_main_bottomTitle"
android:text="@string/meglive_prompt" android:layout_marginBottom="15dip"
android:textColor="#00ACDF" android:layout_marginTop="15dip"
android:textSize="16dp" /> android:visibility="gone" />
<ImageView <LinearLayout
android:layout_width="wrap_content" android:id="@+id/liveness_layout_bottom_tips_head"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dip" android:layout_above="@+id/activity_main_bottomTitle"
android:src="@drawable/liveness_phoneimage" /> android:layout_centerHorizontal="true"
</LinearLayout> android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/liveness_layout_promptText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:text="@string/meglive_prompt"
android:textColor="#00ACDF"
android:textSize="16dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dip"
android:src="@drawable/liveness_phoneimage" />
</LinearLayout>
<RelativeLayout
android:id="@+id/detection_step_timeoutRel"
android:layout_width="35dip"
android:layout_height="35dip"
android:layout_alignParentRight="true"
android:layout_margin="5dip"
android:visibility="invisible">
<TextView
android:id="@+id/detection_step_timeout_garden"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="10"
android:textColor="#00BEE2"
android:textSize="20sp" />
<com.megvii.idcardlib.view.CircleProgressBar
android:id="@+id/detection_step_timeout_progressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout <ImageView
android:id="@+id/detection_step_timeoutRel" android:layout_width="70dp"
android:layout_width="35dip" android:layout_height="70dp"
android:layout_height="35dip"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_margin="5dip" android:layout_alignParentTop="true"
android:visibility="invisible" > android:layout_marginRight="20dp"
android:scaleType="centerInside"
android:src="@drawable/liveness_faceppinside"
android:visibility="gone" />
<TextView <ProgressBar
android:id="@+id/detection_step_timeout_garden" android:id="@+id/liveness_layout_progressbar"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:text="10" android:visibility="invisible" />
android:textColor="#00BEE2"
android:textSize="20sp" />
<com.megvii.idcardlib.view.CircleProgressBar
android:id="@+id/detection_step_timeout_progressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
</layout>
<ImageView \ No newline at end of file
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="20dp"
android:scaleType="centerInside"
android:src="@drawable/liveness_faceppinside" />
<ProgressBar
android:id="@+id/liveness_layout_progressbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="invisible" />
</RelativeLayout>
\ No newline at end of file
package com.dayu.common;
import android.text.Editable;
import android.text.TextWatcher;
/**
* Created by luofan
* on 2018/6/20.
*/
public class MyTextWatcher implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
}
...@@ -31,8 +31,8 @@ public class UserManager { ...@@ -31,8 +31,8 @@ public class UserManager {
} }
} }
public void saveUserForJson(String json){ public void saveUserForJson(String json) {
SPUtils.put("USER_INFO",json); SPUtils.put("USER_INFO", json);
} }
public UserInfo getUser() { public UserInfo getUser() {
...@@ -63,8 +63,9 @@ public class UserManager { ...@@ -63,8 +63,9 @@ public class UserManager {
UserInfo userInfo = getUser(); UserInfo userInfo = getUser();
if (userInfo != null) { if (userInfo != null) {
//有数据 //有数据
//TODO
if (!TextUtils.isEmpty(userInfo.getAccountId()) && !TextUtils.isEmpty(userInfo.getSiteId()) if (!TextUtils.isEmpty(userInfo.getAccountId()) && !TextUtils.isEmpty(userInfo.getSiteId())
&& !TextUtils.isEmpty(userInfo.getAccountName()) && userInfo.getDetectStatus() == 1) { && !TextUtils.isEmpty(userInfo.getAccountName()) && userInfo.getDetectStatus() == 1 && !TextUtils.isEmpty((String) SPUtils.get("USER_IDENTITY", ""))) {
return true; return true;
} else { } else {
return false; return false;
......
...@@ -274,7 +274,8 @@ ...@@ -274,7 +274,8 @@
<string name="send_already">已发货</string> <string name="send_already">已发货</string>
<string name="modify_part_info">修改信息</string> <string name="modify_part_info">修改信息</string>
<string name="customer_acceptance">客户验收</string> <string name="customer_acceptance">客户验收</string>
<string name="scan_code_for_appointment">请扫描二维码验收</string> <string name="scan_code_for_appointment">请扫描二维码关注大鱼服务公众号</string>
<string name="scan_code_for_appointment_two">点击-我的服务-进行绑定登录后,选择工单付款</string>
<string name="order_record">工单记录</string> <string name="order_record">工单记录</string>
<string name="order_num">工单编号</string> <string name="order_num">工单编号</string>
<string name="order_state">工单状态</string> <string name="order_state">工单状态</string>
...@@ -311,8 +312,8 @@ ...@@ -311,8 +312,8 @@
<string name="order_select_payer_notice">修改费用承担方可能会导致费用争议,请一定要确认清楚之后再操作</string> <string name="order_select_payer_notice">修改费用承担方可能会导致费用争议,请一定要确认清楚之后再操作</string>
<string name="order_payer_prove">费用承担证明</string> <string name="order_payer_prove">费用承担证明</string>
<string name="server_info">服务信息</string> <string name="server_info">服务信息</string>
<string name="payer_baonei">派单方承担(保内)</string> <string name="payer_baonei">派单方承担</string>
<string name="payer_baowai">用户承担(保外)</string> <string name="payer_baowai">用户承担</string>
<string name="payer_dialog_content">您还没有选择费用承担方,请选择后再提交验收</string> <string name="payer_dialog_content">您还没有选择费用承担方,请选择后再提交验收</string>
<string name="payer_dialog_title">未选择费用承担方</string> <string name="payer_dialog_title">未选择费用承担方</string>
<string name="payer_select_title">确认操作</string> <string name="payer_select_title">确认操作</string>
......
...@@ -68,4 +68,5 @@ dependencies { ...@@ -68,4 +68,5 @@ dependencies {
//ARouter //ARouter
annotationProcessor "com.alibaba:arouter-compiler:$arouter_compiler_version" annotationProcessor "com.alibaba:arouter-compiler:$arouter_compiler_version"
compile project(':provider') compile project(':provider')
compile project(':IDCardLib')
} }
...@@ -137,4 +137,8 @@ public class OrderApiFactory { ...@@ -137,4 +137,8 @@ public class OrderApiFactory {
public static Observable<companyManager> getManagerMobile(int companyId, int managerType) { public static Observable<companyManager> getManagerMobile(int companyId, int managerType) {
return Api.getService(OrderService.class).getManagerMobile(companyId,managerType).compose(Api.applySchedulers()); return Api.getService(OrderService.class).getManagerMobile(companyId,managerType).compose(Api.applySchedulers());
} }
public static Observable<Boolean> certificationLive(RequestBody body) {
return Api.getService(OrderService.class).certificationLive(body).compose(Api.applySchedulers());
}
} }
...@@ -284,6 +284,7 @@ interface OrderService { ...@@ -284,6 +284,7 @@ interface OrderService {
/** /**
* 单任务多数量提交工单. * 单任务多数量提交工单.
*
* @param body * @param body
* @return * @return
*/ */
...@@ -292,6 +293,7 @@ interface OrderService { ...@@ -292,6 +293,7 @@ interface OrderService {
/** /**
* 查看多任务处理工单信息. * 查看多任务处理工单信息.
*
* @param id * @param id
* @return * @return
*/ */
...@@ -300,8 +302,17 @@ interface OrderService { ...@@ -300,8 +302,17 @@ interface OrderService {
/** /**
* 获取技术支持电话 * 获取技术支持电话
*
* @return * @return
*/ */
@GET(OrderConstant.COMPAY_MANAGER_MOBILE) @GET(OrderConstant.COMPAY_MANAGER_MOBILE)
Observable<BaseResponse<companyManager>> getManagerMobile(@Query("companyId") int companyId, @Query("managerType") int managerType); Observable<BaseResponse<companyManager>> getManagerMobile(@Query("companyId") int companyId, @Query("managerType") int managerType);
/**
* 接单活体检测.
*
* @return
*/
@GET(OrderConstant.FACE_CERTIFICAITON)
Observable<BaseResponse<Boolean>> certificationLive(@Body RequestBody body);
} }
package com.dayu.order.api.protocol; package com.dayu.order.api.protocol;
import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* 工单列表,异常单列表,工单记录列表的bean * 工单列表,异常单列表,工单记录列表的bean
* Created by luofan on 2017/11/14. * Created by luofan on 2017/11/14.
*/ */
public class Order { public class Order implements Serializable{
/** /**
* id : 20 * id : 20
* orderNum : 201709249030024287834 接单数 * orderNum : 201709249030024287834 接单数
...@@ -53,6 +54,15 @@ public class Order { ...@@ -53,6 +54,15 @@ public class Order {
private List<Spu> spus; private List<Spu> spus;
private Integer commited; private Integer commited;
private Integer kaCompanyId; private Integer kaCompanyId;
private Integer faceSwitch ;//0:关闭;1:打开
public Integer getFaceSwitch() {
return faceSwitch;
}
public void setFaceSwitch(Integer faceSwitch) {
this.faceSwitch = faceSwitch;
}
public Integer getKaCompanyId() { public Integer getKaCompanyId() {
return kaCompanyId; return kaCompanyId;
......
...@@ -47,15 +47,15 @@ public class OrderDetail implements Serializable { ...@@ -47,15 +47,15 @@ public class OrderDetail implements Serializable {
private Object customerCheckComment; private Object customerCheckComment;
private Integer isPay; private Integer isPay;
private Object payType; private Object payType;
private Integer doorPrice; private Double doorPrice;
private String doorPriceComment; private String doorPriceComment;
private Integer servicePrice; private Double servicePrice;
private Object servicePriceComment; private Object servicePriceComment;
private Integer materialCost; private Integer materialCost;
private Object materialCostComment; private Object materialCostComment;
private Integer otherPrice; private double otherPrice;
private Object otherPriceComment; private Object otherPriceComment;
private Integer totalPrice; private Double totalPrice;
private Object cancelOrderReason; private Object cancelOrderReason;
private Object closePhase; private Object closePhase;
private int siteId; private int siteId;
...@@ -428,11 +428,11 @@ public class OrderDetail implements Serializable { ...@@ -428,11 +428,11 @@ public class OrderDetail implements Serializable {
this.payType = payType; this.payType = payType;
} }
public Integer getDoorPrice() { public Double getDoorPrice() {
return doorPrice; return doorPrice;
} }
public void setDoorPrice(Integer doorPrice) { public void setDoorPrice(Double doorPrice) {
this.doorPrice = doorPrice; this.doorPrice = doorPrice;
} }
...@@ -444,11 +444,11 @@ public class OrderDetail implements Serializable { ...@@ -444,11 +444,11 @@ public class OrderDetail implements Serializable {
this.doorPriceComment = doorPriceComment; this.doorPriceComment = doorPriceComment;
} }
public Integer getServicePrice() { public Double getServicePrice() {
return servicePrice; return servicePrice;
} }
public void setServicePrice(Integer servicePrice) { public void setServicePrice(Double servicePrice) {
this.servicePrice = servicePrice; this.servicePrice = servicePrice;
} }
...@@ -476,11 +476,11 @@ public class OrderDetail implements Serializable { ...@@ -476,11 +476,11 @@ public class OrderDetail implements Serializable {
this.materialCostComment = materialCostComment; this.materialCostComment = materialCostComment;
} }
public Integer getOtherPrice() { public Double getOtherPrice() {
return otherPrice; return otherPrice;
} }
public void setOtherPrice(Integer otherPrice) { public void setOtherPrice(Double otherPrice) {
this.otherPrice = otherPrice; this.otherPrice = otherPrice;
} }
...@@ -492,11 +492,11 @@ public class OrderDetail implements Serializable { ...@@ -492,11 +492,11 @@ public class OrderDetail implements Serializable {
this.otherPriceComment = otherPriceComment; this.otherPriceComment = otherPriceComment;
} }
public Integer getTotalPrice() { public Double getTotalPrice() {
return totalPrice; return totalPrice;
} }
public void setTotalPrice(Integer totalPrice) { public void setTotalPrice(Double totalPrice) {
this.totalPrice = totalPrice; this.totalPrice = totalPrice;
} }
......
...@@ -152,4 +152,8 @@ public class OrderConstant { ...@@ -152,4 +152,8 @@ public class OrderConstant {
*/ */
public final static String COMPAY_MANAGER_MOBILE = "/api-ka-user/" + "companyManager/findCompanyManagerBy"; public final static String COMPAY_MANAGER_MOBILE = "/api-ka-user/" + "companyManager/findCompanyManagerBy";
/**
* 接单活体检测校验.
*/
public final static String FACE_CERTIFICAITON = "/api-third/" +"detect/receiptOrderVerify";
} }
...@@ -3,6 +3,7 @@ package com.dayu.order.presenter.multipleprocess; ...@@ -3,6 +3,7 @@ package com.dayu.order.presenter.multipleprocess;
import com.dayu.base.ui.presenter.BaseListPresenter; import com.dayu.base.ui.presenter.BaseListPresenter;
import com.dayu.common.BaseView; import com.dayu.common.BaseView;
import com.dayu.widgets.listener.OnCloseListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -27,6 +28,12 @@ public interface MultipleProcessContract { ...@@ -27,6 +28,12 @@ public interface MultipleProcessContract {
void showSignature(); void showSignature();
void setPayStatus(); void setPayStatus();
void showSelectPayerDialog(OnCloseListener listener);
void showNoPayerDialog();
boolean getSelectPayer();
} }
abstract class Presenter extends BaseListPresenter<View> { abstract class Presenter extends BaseListPresenter<View> {
......
package com.dayu.order.presenter.multipleprocess; package com.dayu.order.presenter.multipleprocess;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.os.Bundle;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.dayu.base.api.BaseApiFactory; import com.dayu.base.api.BaseApiFactory;
import com.dayu.common.Constants;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory; import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.common.OrderConstant; import com.dayu.order.common.OrderConstant;
import com.dayu.order.ui.activity.QrCodeActivity;
import com.dayu.order.ui.activity.SignatureActivity; import com.dayu.order.ui.activity.SignatureActivity;
import com.dayu.provider.event.RefreshServe; import com.dayu.provider.event.RefreshServe;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
...@@ -41,7 +44,6 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -41,7 +44,6 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
private ArrayList<String> mImages = new ArrayList<>(); private ArrayList<String> mImages = new ArrayList<>();
private Integer mNeedEsignature; private Integer mNeedEsignature;
private String mSignatureUrl; private String mSignatureUrl;
private boolean canPay;
@Override @Override
public void onAttached() { public void onAttached() {
...@@ -67,11 +69,19 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -67,11 +69,19 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
public void process() { public void process() {
File file = new File(SignatureActivity.path); File file = new File(SignatureActivity.path);
if (!file.exists()) { if (mNeedEsignature == 1 && !file.exists()) {
ToastUtils.showShortToast("请让客户签名!"); ToastUtils.showShortToast("请让客户签名!");
return; return;
} }
commitePhoto(); if (mView.getSelectPayer()) {
mView.showNoPayerDialog();
} else {
mView.showSelectPayerDialog((dialog, confirm) -> {
if (confirm) {
commitePhoto();
}
});
}
} }
private void commitePhoto() { private void commitePhoto() {
...@@ -154,8 +164,14 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -154,8 +164,14 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString()); RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
OrderApiFactory.commitOrder(body).subscribe(baseObserver(integer -> { OrderApiFactory.commitOrder(body).subscribe(baseObserver(integer -> {
ToastUtils.showShortToast("提交验收成功"); ToastUtils.showShortToast("提交验收成功");
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); if (integer == 6) {
EventBus.getDefault().post(new RefreshServe(1)); Bundle bundle = new Bundle();
bundle.putInt(Constants.TYPE, 1);
mView.startActivity(QrCodeActivity.class, bundle);
} else {
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
EventBus.getDefault().post(new RefreshServe(1));
}
})); }));
} }
...@@ -175,8 +191,8 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -175,8 +191,8 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
} }
Integer isPay = detail.getIsPay(); Integer isPay = detail.getIsPay();
Integer payState = detail.getPayStatus(); Integer payState = detail.getPayStatus();
if (isPay == 2 && payState == 3) { if (isPay == 2 && (payState == 3 || payState == 2)) {
mView.setPayStatus(); mView.setPayStatus();
} }
})); }));
} }
......
...@@ -5,12 +5,18 @@ import android.os.Bundle; ...@@ -5,12 +5,18 @@ import android.os.Bundle;
import com.dayu.common.BaseApplication; import com.dayu.common.BaseApplication;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.provider.event.RefreshTab;
import com.dayu.event.UserInfo; import com.dayu.event.UserInfo;
import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory; import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.protocol.Order;
import com.dayu.order.common.OrderConstant;
import com.dayu.order.ui.activity.OrderDetailsActivity; import com.dayu.order.ui.activity.OrderDetailsActivity;
import com.dayu.order.ui.activity.OrderLivenessActivity;
import com.dayu.order.ui.fragment.OrderThreeTabFragment; import com.dayu.order.ui.fragment.OrderThreeTabFragment;
import com.dayu.provider.event.RefreshTab;
import com.dayu.utils.AppManager;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
import com.dayu.widgets.CustomDialog;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
...@@ -22,12 +28,15 @@ import io.reactivex.Observable; ...@@ -22,12 +28,15 @@ import io.reactivex.Observable;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import static com.dayu.utils.UIUtils.getString;
/** /**
* Created by luofan * Created by luofan
* on 2017/11/8. * on 2017/11/8.
*/ */
public class OrderDoingPresenter extends orderDoingContract.Presenter { public class OrderDoingPresenter extends orderDoingContract.Presenter {
private ObservableField<Object> datas = new ObservableField<>(); private ObservableField<Object> datas = new ObservableField<>();
private static final int PAGE_INTO_LIVENESS = 100;
private int mUserId; private int mUserId;
private int mSiteId; private int mSiteId;
private int mState; private int mState;
...@@ -75,7 +84,7 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter { ...@@ -75,7 +84,7 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter {
@Override @Override
public void getErrorOrder() { public void getErrorOrder() {
OrderApiFactory.getErrorOrders(mUserId, mSiteId).subscribe( OrderApiFactory.getErrorOrders(mUserId, mSiteId).subscribe(
baseObserver( errorOrder -> { baseObserver(errorOrder -> {
datas.set(errorOrder); datas.set(errorOrder);
EventBus.getDefault().post(new RefreshTab(-1)); EventBus.getDefault().post(new RefreshTab(-1));
}, responeThrowable -> datas.set(Constants.FAILED))); }, responeThrowable -> datas.set(Constants.FAILED)));
...@@ -104,10 +113,27 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter { ...@@ -104,10 +113,27 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter {
} }
@Override @Override
public void dumpToFaceCert(Order order) {
CustomDialog customDialog = new CustomDialog(AppManager.getInstance().currentActivity(), R.style.CustomDialog, "为了保证您的账号安全和用户安全,请您本人进行人脸识别操作",
(dialog, confirm) -> {
if (confirm) {
Bundle bundle = new Bundle();
bundle.putSerializable(OrderConstant.ORDERS,order);
mView.startActivity(OrderLivenessActivity.class, bundle);
}
});
customDialog.setTitle("人脸识别")
.setNegativeButton(getString(R.string.cancle))
.setPositiveButton("去认证");
customDialog.show();
}
@Override
public void dumpDetail(int orderId) { public void dumpDetail(int orderId) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putInt(Constants.ORDER_ID,orderId); bundle.putInt(Constants.ORDER_ID, orderId);
mView.startActivity(OrderDetailsActivity.class,bundle); mView.startActivity(OrderDetailsActivity.class, bundle);
MobclickAgent.onEvent(BaseApplication.getContext(), "check_order_detail"); MobclickAgent.onEvent(BaseApplication.getContext(), "check_order_detail");
} }
} }
...@@ -2,6 +2,7 @@ package com.dayu.order.presenter.orderdoing; ...@@ -2,6 +2,7 @@ package com.dayu.order.presenter.orderdoing;
import com.dayu.common.BaseView; import com.dayu.common.BaseView;
import com.dayu.order.api.protocol.Order;
import com.dayu.order.presenter.BaseOrderPresenter; import com.dayu.order.presenter.BaseOrderPresenter;
import io.reactivex.Observable; import io.reactivex.Observable;
...@@ -45,5 +46,7 @@ public interface orderDoingContract { ...@@ -45,5 +46,7 @@ public interface orderDoingContract {
*/ */
public abstract Observable<Integer> startServer(int orderId, double latitude, double longitude); public abstract Observable<Integer> startServer(int orderId, double latitude, double longitude);
public abstract void dumpToFaceCert(Order order);
} }
} }
package com.dayu.order.presenter.orderliveness;
import com.dayu.base.ui.presenter.BasePresenter;
import com.dayu.common.BaseView;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by luo
* on 2016/8/4.
*/
public interface OrderLivenessContract {
interface View extends BaseView {
}
abstract class Presenter extends BasePresenter<View> {
public abstract void verifyIdentity(List<String> list);
public abstract void commitePhoto(ArrayList<File> list, String delta);
}
}
package com.dayu.order.presenter.orderliveness;
import android.os.Bundle;
import com.dayu.base.api.BaseApiFactory;
import com.dayu.common.Constants;
import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.protocol.Order;
import com.dayu.order.common.OrderConstant;
import com.dayu.order.ui.activity.ServerInfoActivity;
import com.dayu.order.ui.activity.ServerListActivity;
import com.dayu.utils.SPUtils;
import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
/**
* Created by luofan
* on 2017/11/8.
*/
public class OrderLivenessPresenter extends OrderLivenessContract.Presenter {
private String mDelta;
private Order mOrder;
private String mName;
private String mCardNum;
@Override
public void onAttached() {
Bundle bundle = mView.getBundle();
mOrder = (Order) bundle.getSerializable(OrderConstant.ORDERS);
mName = UserManager.getInstance().getUser().getAccountName();
mCardNum = (String) SPUtils.get("USER_IDENTITY", "");
}
@Override
public void commitePhoto(ArrayList<File> list, String delta) {
mDelta = delta;
BaseApiFactory.uploadPhoto(packPhoto(list), "nowatermark").subscribe(baseObserver(this::verifyIdentity));
}
private MultipartBody.Part[] packPhoto(List<File> files) {
MultipartBody.Part[] part = new MultipartBody.Part[files.size()];
for (int i = 0; i < files.size(); i++) {
RequestBody requestFile =
RequestBody.create(MediaType.parse("multipart/form-data"), files.get(i));
MultipartBody.Part body =
MultipartBody.Part.createFormData("fileUpload", files.get(i).getName(), requestFile);
part[i] = body;
}
return part;
}
@Override
public void verifyIdentity(List<String> list) {
HashMap<String, Object> params = new HashMap<>();
params.put("name", mName);
params.put("cardNumber", mCardNum);
params.put("checkDelta", 0);
params.put("comparisonType", 1);
params.put("delta", mDelta);
params.put("imageAction1Url", list.get(2));
params.put("imageBestUrl", list.get(0));
params.put("imageEnvUrl", list.get(1));
params.put("multiOrientedDetection", 1);
JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
mView.showDialog();
Bundle bundle = new Bundle();
OrderApiFactory.certificationLive(body).subscribe(baseObserver(aBoolean -> {
if (aBoolean) {
SPUtils.put(Constants.ORDER_ID+mOrder.getId(),true);
if (mOrder.getKaCompanyId() != null) {
bundle.putInt(OrderConstant.KAADDRESSID, mOrder.getKaCompanyId());
}
if (mOrder.getSpus().size() > 1) {
bundle.putInt(Constants.ID, mOrder.getId());
mView.startActivity(ServerInfoActivity.class, bundle);
} else if (mOrder.getSpus().size() == 1) {
bundle.putInt(Constants.ID, mOrder.getSpus().get(0).getId());
mView.startActivity(ServerListActivity.class, bundle);
}
}
}, responeThrowable -> {
if ("DETECT_ERROR00001".equals(responeThrowable.subCode)) {
ToastUtils.showShortToast(R.string.please_upload_cleare_identity);
} else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) {
ToastUtils.showShortToast(R.string.please_upload_yourself_face);
} else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) {
ToastUtils.showShortToast(R.string.server_error);
} else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) {
ToastUtils.showShortToast(R.string.please_upload_identity_front);
} else {
ToastUtils.showShortToast(R.string.certification_not_pass);
}
mView.dumpBack();
}));
}
}
...@@ -23,12 +23,14 @@ public interface ProcessOrderContract { ...@@ -23,12 +23,14 @@ public interface ProcessOrderContract {
/** /**
* 初始化图片. * 初始化图片.
*
* @param list * @param list
*/ */
void initPhotoView(ArrayList<String> list); void initPhotoView(ArrayList<String> list);
/** /**
* 初始化费用承担证明图片. * 初始化费用承担证明图片.
*
* @param list * @param list
*/ */
void initPayerPhotoView(ArrayList<String> list); void initPayerPhotoView(ArrayList<String> list);
...@@ -59,7 +61,6 @@ public interface ProcessOrderContract { ...@@ -59,7 +61,6 @@ public interface ProcessOrderContract {
public abstract void getOrderInfo(int orderId); public abstract void getOrderInfo(int orderId);
/** /**
*
* @param imageUrl * @param imageUrl
* @param orderId * @param orderId
* @param editText * @param editText
...@@ -79,9 +80,9 @@ public interface ProcessOrderContract { ...@@ -79,9 +80,9 @@ public interface ProcessOrderContract {
public abstract void commitOrder(List<String> imageUrl, int orderId, String editText, int engineerId, public abstract void commitOrder(List<String> imageUrl, int orderId, String editText, int engineerId,
int isPay, String doorPrice, String doorPriceComment, int isPay, String doorPrice, String doorPriceComment,
String servicePrice, String materialCost, String otherPrice, String servicePrice, String materialCost, String otherPrice,
String brandName,String productModel,String sn,int repairType,List<String> picsCost); String brandName, String productModel, String sn, int repairType, List<String> picsCost);
public abstract void commitPhoto(List<String> imageUrl,List<String> payerUrl); public abstract void commitPhoto(List<String> imageUrl, List<String> payerUrl);
/** /**
* 保存订单. * 保存订单.
...@@ -100,13 +101,12 @@ public interface ProcessOrderContract { ...@@ -100,13 +101,12 @@ public interface ProcessOrderContract {
/** /**
* 跳转到服务说明. * 跳转到服务说明.
*/ */
public abstract void dumpToServerInstruction(); public abstract void dumpToServerInstruction();
/** /**
* 显示费用承担方. * 显示费用承担方.
*/ */
public abstract void showPayerDialog(); public abstract void showPayerDialog();
} }
} }
...@@ -2,6 +2,8 @@ package com.dayu.order.ui.activity; ...@@ -2,6 +2,8 @@ package com.dayu.order.ui.activity;
import android.content.Intent; import android.content.Intent;
import android.os.Environment; import android.os.Environment;
import android.text.Editable;
import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -15,6 +17,7 @@ import com.bigkoo.pickerview.builder.OptionsPickerBuilder; ...@@ -15,6 +17,7 @@ import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.view.OptionsPickerView; import com.bigkoo.pickerview.view.OptionsPickerView;
import com.dayu.base.ui.activity.BaseActivity; import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.common.MyTextWatcher;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.databinding.ActivityMultipleProcessBinding; import com.dayu.order.databinding.ActivityMultipleProcessBinding;
import com.dayu.order.presenter.multipleprocess.MultipleProcessContract; import com.dayu.order.presenter.multipleprocess.MultipleProcessContract;
...@@ -23,7 +26,9 @@ import com.dayu.utils.GlideImageLoader; ...@@ -23,7 +26,9 @@ import com.dayu.utils.GlideImageLoader;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UIUtils; import com.dayu.utils.UIUtils;
import com.dayu.utils.UtilsScreen; import com.dayu.utils.UtilsScreen;
import com.dayu.widgets.CustomDialog;
import com.dayu.widgets.SwitchImage; import com.dayu.widgets.SwitchImage;
import com.dayu.widgets.listener.OnCloseListener;
import com.luck.picture.lib.PictureSelectionModel; import com.luck.picture.lib.PictureSelectionModel;
import com.luck.picture.lib.PictureSelector; import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig; import com.luck.picture.lib.config.PictureConfig;
...@@ -31,6 +36,7 @@ import com.luck.picture.lib.config.PictureMimeType; ...@@ -31,6 +36,7 @@ import com.luck.picture.lib.config.PictureMimeType;
import com.luck.picture.lib.entity.LocalMedia; import com.luck.picture.lib.entity.LocalMedia;
import java.io.File; import java.io.File;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -63,6 +69,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent ...@@ -63,6 +69,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
private boolean isShowSignature; private boolean isShowSignature;
private SwitchImage swtich; private SwitchImage swtich;
private boolean canPay; private boolean canPay;
private TextView mTotalMoney;
@Override @Override
public void setPresenter() { public void setPresenter() {
...@@ -105,6 +112,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent ...@@ -105,6 +112,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
mServerPrice = view.findViewById(R.id.et_serve_price); mServerPrice = view.findViewById(R.id.et_serve_price);
mMaterialsPrice = view.findViewById(R.id.et_materials_price); mMaterialsPrice = view.findViewById(R.id.et_materials_price);
mOtherPrice = view.findViewById(R.id.et_other_price); mOtherPrice = view.findViewById(R.id.et_other_price);
mTotalMoney = view.findViewById(R.id.tv_total_money);
mDoorInfo = view.findViewById(R.id.et_door_info); mDoorInfo = view.findViewById(R.id.et_door_info);
mRepairType = view.findViewById(R.id.tv_payer); mRepairType = view.findViewById(R.id.tv_payer);
mArrow = view.findViewById(R.id.iv_payer); mArrow = view.findViewById(R.id.iv_payer);
...@@ -114,7 +122,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent ...@@ -114,7 +122,7 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
mIcon = view.findViewById(R.id.tv_icon); mIcon = view.findViewById(R.id.tv_icon);
swtich.setOnClickListener(v -> { swtich.setOnClickListener(v -> {
if (true) { if (canPay) {
ToastUtils.showShortToast("您上次已经收取过客户费用,请勿重新收取!"); ToastUtils.showShortToast("您上次已经收取过客户费用,请勿重新收取!");
} else { } else {
if (swtich.getSwitchButton()) { if (swtich.getSwitchButton()) {
...@@ -146,12 +154,50 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent ...@@ -146,12 +154,50 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
mArrow.setVisibility(View.GONE); mArrow.setVisibility(View.GONE);
mPayerNotice.setVisibility(View.GONE); mPayerNotice.setVisibility(View.GONE);
} }
mSignature.setOnClickListener(v -> { mSignature.setOnClickListener(v -> startActivityForReult(SignatureActivity.class, 100));
startActivityForReult(SignatureActivity.class, 100);
});
if (isShowSignature) { if (isShowSignature) {
mAllSignature.setVisibility(View.VISIBLE); mAllSignature.setVisibility(View.VISIBLE);
} }
initTotal();
}
private void initTotal() {
mDoorPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mTotalMoney.setText(getSum());
}
});
mServerPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mTotalMoney.setText(getSum());
}
});
mMaterialsPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mTotalMoney.setText(getSum());
}
});
mOtherPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mTotalMoney.setText(getSum());
}
});
}
public String getSum() {
return new DecimalFormat("0.00").format(parseDb(mDoorPrice.getText().toString()) + parseDb(mServerPrice.getText().toString()) + parseDb(mMaterialsPrice.getText().toString()) + parseDb(mOtherPrice.getText().toString()));
}
public Double parseDb(String str) {
if (TextUtils.isEmpty(str)) {
return 0.0;
} else {
return Double.parseDouble(str);
}
} }
@Override @Override
...@@ -298,6 +344,32 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent ...@@ -298,6 +344,32 @@ public class MultipleProcessActivity extends BaseActivity<MultipleProcessPresent
} }
@Override @Override
public void showNoPayerDialog() {
CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.payer_dialog_content)
, (dialog, confirm) -> dialog.dismiss());
customDialog.setTitle(getString(R.string.payer_dialog_title))
.setPositiveButton(getString(R.string.comfirm))
.setOneButton(true);
customDialog.show();
}
@Override
public boolean getSelectPayer() {
return TextUtils.isEmpty(mRepairType.getText().toString());
}
@Override
public void showSelectPayerDialog(OnCloseListener listener) {
CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.payer_select_content)
, listener);
customDialog.setTitle(getString(R.string.payer_select_title))
.setNegativeButton(getString(R.string.cancle))
.setPositiveButton(getString(R.string.submit))
.setPositiveButtonColor(UIUtils.getColor(R.color.common_red));
customDialog.show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
......
package com.dayu.order.ui.activity;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.Size;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.view.TextureView;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.order.R;
import com.dayu.order.databinding.LivenessLayoutBinding;
import com.dayu.order.presenter.orderliveness.OrderLivenessContract;
import com.dayu.order.presenter.orderliveness.OrderLivenessPresenter;
import com.dayu.utils.ToastUtils;
import com.megvii.idcardlib.FaceMask;
import com.megvii.idcardlib.util.ConUtil;
import com.megvii.idcardlib.util.DialogUtil;
import com.megvii.idcardlib.util.FaceCamera;
import com.megvii.idcardlib.util.IDetection;
import com.megvii.idcardlib.util.IMediaPlayer;
import com.megvii.idcardlib.util.Screen;
import com.megvii.idcardlib.util.SensorUtil;
import com.megvii.idcardlib.view.CircleProgressBar;
import com.megvii.licensemanager.Manager;
import com.megvii.livenessdetection.DetectionConfig;
import com.megvii.livenessdetection.DetectionFrame;
import com.megvii.livenessdetection.Detector;
import com.megvii.livenessdetection.Detector.DetectionFailedType;
import com.megvii.livenessdetection.Detector.DetectionListener;
import com.megvii.livenessdetection.Detector.DetectionType;
import com.megvii.livenessdetection.FaceQualityManager;
import com.megvii.livenessdetection.FaceQualityManager.FaceQualityErrorType;
import com.megvii.livenessdetection.LivenessLicenseManager;
import com.megvii.livenessdetection.bean.FaceIDDataStruct;
import com.megvii.livenessdetection.bean.FaceInfo;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class OrderLivenessActivity extends BaseActivity<OrderLivenessPresenter,LivenessLayoutBinding>
implements PreviewCallback, DetectionListener, TextureView.SurfaceTextureListener ,OrderLivenessContract.View{
private TextureView camerapreview;
private FaceMask mFaceMask;// 画脸位置的类(调试时会用到)
private ProgressBar mProgressBar;// 网络上传请求验证时出现的ProgressBar
private LinearLayout headViewLinear;// "请在光线充足的情况下进行检测"这个视图
private RelativeLayout rootView;// 根视图
private TextView timeOutText;
private RelativeLayout timeOutRel;
private CircleProgressBar mCircleProgressBar;
private Detector mDetector;// 活体检测器
private FaceCamera mICamera;// 照相机工具类
private Handler mainHandler;
private HandlerThread mHandlerThread = new HandlerThread("videoEncoder");
private Handler mHandler;
private JSONObject jsonObject;
private IMediaPlayer mIMediaPlayer;// 多媒体工具类
private IDetection mIDetection;
private DialogUtil mDialogUtil;
private TextView promptText;
private boolean isHandleStart;// 是否开始检测
private FaceQualityManager mFaceQualityManager;
private SensorUtil sensorUtil;
private String uuid;
@Override
public int getLayoutId() {
return R.layout.liveness_layout;
}
@Override
public void initView() {
uuid = ConUtil.getUUIDString(this);
new Thread(() -> {
Manager manager = new Manager(OrderLivenessActivity.this);
LivenessLicenseManager licenseManager = new LivenessLicenseManager(OrderLivenessActivity.this);
manager.registerLicenseManager(licenseManager);
manager.takeLicenseFromNetwork(uuid);
if (licenseManager.checkCachedLicense() < 0) {
runOnUiThread(() -> ToastUtils.showShortToast(getString(R.string.accredit_error)));
} else {
initData();
}
}).start();
init();
}
@Override
public void setPresenter() {
}
private void init() {
sensorUtil = new SensorUtil(this);
Screen.initialize(this);
mainHandler = new Handler();
mHandlerThread.start();
mHandler = new Handler(mHandlerThread.getLooper());
mIMediaPlayer = new IMediaPlayer(this);
mDialogUtil = new DialogUtil(this);
rootView = (RelativeLayout) findViewById(com.megvii.idcardlib.R.id.liveness_layout_rootRel);
mIDetection = new IDetection(this, rootView);
mFaceMask = (FaceMask) findViewById(com.megvii.idcardlib.R.id.liveness_layout_facemask);
mICamera = new FaceCamera();
promptText = (TextView) findViewById(com.megvii.idcardlib.R.id.liveness_layout_promptText);
camerapreview = (TextureView) findViewById(com.megvii.idcardlib.R.id.liveness_layout_textureview);
camerapreview.setSurfaceTextureListener(this);
mProgressBar = (ProgressBar) findViewById(com.megvii.idcardlib.R.id.liveness_layout_progressbar);
mProgressBar.setVisibility(View.INVISIBLE);
headViewLinear = (LinearLayout) findViewById(com.megvii.idcardlib.R.id.liveness_layout_bottom_tips_head);
headViewLinear.setVisibility(View.VISIBLE);
timeOutRel = (RelativeLayout) findViewById(com.megvii.idcardlib.R.id.detection_step_timeoutRel);
timeOutText = (TextView) findViewById(com.megvii.idcardlib.R.id.detection_step_timeout_garden);
mCircleProgressBar = (CircleProgressBar) findViewById(com.megvii.idcardlib.R.id.detection_step_timeout_progressBar);
mIDetection.viewsInit();
}
/**
* 初始化数据
*/
private void initData() {
// 初始化活体检测器
DetectionConfig config = new DetectionConfig.Builder().build();
mDetector = new Detector(this, config);
boolean initSuccess = mDetector.init(this, ConUtil.readModel(this), "");
if (!initSuccess) {
mDialogUtil.showDialog(getString(com.megvii.idcardlib.R.string.meglive_detect_initfailed));
}
// 初始化动画
new Thread(new Runnable() {
@Override
public void run() {
mIDetection.animationInit();
}
}).start();
}
@Override
public void onResume() {
super.onResume();
isHandleStart = false;
int cameraID = 1;
if (!FaceCamera.hasFrontFacingCamera())
cameraID = 0;
// 打开照相机
Camera mCamera = mICamera.openCamera(this, cameraID);
if (mCamera != null) {
CameraInfo cameraInfo = new CameraInfo();
Camera.getCameraInfo(cameraID, cameraInfo);
mFaceMask.setFrontal(cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT);
// 获取到相机分辨率对应的显示大小,并把这个值复制给camerapreview
RelativeLayout.LayoutParams layout_params = mICamera.getLayoutParam();
camerapreview.setLayoutParams(layout_params);
mFaceMask.setLayoutParams(layout_params);
// 初始化人脸质量检测管理类
mFaceQualityManager = new FaceQualityManager(1 - 0.5f, 0.5f);
mIDetection.mCurShowIndex = -1;
} else {
mDialogUtil.showDialog(getString(com.megvii.idcardlib.R.string.meglive_camera_initfailed));
}
}
/**
* 开始检测
*/
private void handleStart() {
if (isHandleStart)
return;
isHandleStart = true;
// 开始动画
Animation animationIN = AnimationUtils.loadAnimation(OrderLivenessActivity.this, com.megvii.idcardlib.R.anim.liveness_rightin);
Animation animationOut = AnimationUtils.loadAnimation(OrderLivenessActivity.this, com.megvii.idcardlib.R.anim.liveness_leftout);
headViewLinear.startAnimation(animationOut);
mIDetection.mAnimViews[0].setVisibility(View.VISIBLE);
mIDetection.mAnimViews[0].startAnimation(animationIN);
animationOut.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
timeOutRel.setVisibility(View.VISIBLE);
}
});
// 开始活体检测
mainHandler.post(mTimeoutRunnable);
jsonObject = new JSONObject();
}
private Runnable mTimeoutRunnable = new Runnable() {
@Override
public void run() {
// 倒计时开始
initDetecteSession();
if (mIDetection.mDetectionSteps != null)
changeType(mIDetection.mDetectionSteps.get(0), 10);
}
};
private void initDetecteSession() {
if (mICamera.mCamera == null)
return;
mProgressBar.setVisibility(View.INVISIBLE);
mIDetection.setNum(1);
mIDetection.detectionTypeInit();
mCurStep = 0;
mDetector.reset();
mDetector.changeDetectionType(mIDetection.mDetectionSteps.get(0));
}
/**
* 照相机预览数据回调 (PreviewCallback的接口回调方法)
*/
@Override
public void onPreviewFrame(final byte[] data, Camera camera) {
Size previewsize = camera.getParameters().getPreviewSize();
int angle = 360 - mICamera.getCameraAngle(this);
if (mICamera.cameraId == 0)
angle = angle - 180;
// 活体检测器检测
mDetector.doDetection(data, previewsize.width, previewsize.height, angle);
}
/**
* 活体验证成功 (DetectionListener的接口回调方法)
*/
@Override
public DetectionType onDetectionSuccess(final DetectionFrame validFrame) {
mIMediaPlayer.reset();
mCurStep++;
mFaceMask.setFaceInfo(null);
if (mCurStep == mIDetection.mDetectionSteps.size()) {
mProgressBar.setVisibility(View.VISIBLE);
getLivenessData();
} else
changeType(mIDetection.mDetectionSteps.get(mCurStep), 10);
// 检测器返回值:如果不希望检测器检测则返回DetectionType.DONE,如果希望检测器检测动作则返回要检测的动作
return mCurStep >= mIDetection.mDetectionSteps.size() ? DetectionType.DONE
: mIDetection.mDetectionSteps.get(mCurStep);
}
private void getLivenessData() {
new Thread(new Runnable() {
@Override
public void run() {
final FaceIDDataStruct idDataStruct = mDetector.getFaceIDDataStruct();
final String delta = idDataStruct.delta;
final Map<String, byte[]> images = idDataStruct.images;
runOnUiThread(new Runnable() {
@Override
public void run() {
handleResult(com.megvii.idcardlib.R.string.verify_success, delta, images);
}
});
}
}).start();
}
/**
* 活体检测失败 (DetectionListener的接口回调方法)
*/
@Override
public void onDetectionFailed(final DetectionFailedType type) {
//除下述类型外,还存在其它类型错误,但是不建议提示用户,详细可打印type.toString(),参考活体接口文档
int resourceID = com.megvii.idcardlib.R.string.liveness_detection_failed;
switch (type) {
case ACTIONBLEND:
resourceID = com.megvii.idcardlib.R.string.liveness_detection_failed_action_blend;
break;
case NOTVIDEO:
resourceID = com.megvii.idcardlib.R.string.liveness_detection_failed_not_video;
break;
case TIMEOUT:
resourceID = com.megvii.idcardlib.R.string.liveness_detection_failed_timeout;
break;
}
handleResult(resourceID, null, null);
}
/**
* 活体验证中(这个方法会持续不断的回调,返回照片detection信息) (DetectionListener的接口回调方法)
*/
@Override
public void onFrameDetected(long timeout, DetectionFrame detectionFrame) {
// 如果需要适配加速度传感有问题的机型,可以加入超时自动过垂直判断机制,使用判断条件: sensorUtil.isVertical()||sensorUtil.isSensorFault()
if (sensorUtil.isVertical() || sensorUtil.isSensorFault()) {
faceOcclusion(detectionFrame);
handleNotPass(timeout);
mFaceMask.setFaceInfo(detectionFrame);
} else {
if (sensorUtil.Y == 0 && Build.MANUFACTURER.equals("HUAWEI"))
promptText.setText(com.megvii.idcardlib.R.string.meglive_getpermission_motion);
else
promptText.setText(com.megvii.idcardlib.R.string.meglive_phone_vertical);
}
}
/**
* 照镜子环节
* 流程:1,先从返回的DetectionFrame中获取FaceInfo。在FaceInfo中可以先判断这张照片上的人脸是否有被遮挡的状况
* ,入股有直接return
* 2,如果没有遮挡就把SDK返回的DetectionFramed传入人脸质量检测管理类mFaceQualityManager中获取FaceQualityErrorType的list
* 3.通过返回的list来判断这张照片上的人脸是否合格。
* 如果返回list为空或list中FaceQualityErrorType的对象数量为0则表示这张照片合格开始进行活体检测
*/
private void faceOcclusion(DetectionFrame detectionFrame) {
mFailFrame++;
if (detectionFrame != null) {
FaceInfo faceInfo = detectionFrame.getFaceInfo();
if (faceInfo != null) {
if (faceInfo.eyeLeftOcclusion > 0.5 || faceInfo.eyeRightOcclusion > 0.5) {
if (mFailFrame > 10) {
mFailFrame = 0;
promptText.setText(com.megvii.idcardlib.R.string.meglive_keep_eyes_open);
}
return;
}
if (faceInfo.mouthOcclusion > 0.5) {
if (mFailFrame > 10) {
mFailFrame = 0;
promptText.setText(com.megvii.idcardlib.R.string.meglive_keep_mouth_open);
}
return;
}
boolean faceTooLarge = faceInfo.faceTooLarge;
mIDetection.checkFaceTooLarge(faceTooLarge);
}
}
// 从人脸质量检测管理类中获取错误类型list
faceInfoChecker(mFaceQualityManager.feedFrame(detectionFrame));
}
private int mFailFrame = 0;
public void faceInfoChecker(List<FaceQualityErrorType> errorTypeList) {
if (errorTypeList == null || errorTypeList.size() == 0)
handleStart();
else {
String infoStr = "";
FaceQualityErrorType errorType = errorTypeList.get(0);
if (errorType == FaceQualityErrorType.FACE_NOT_FOUND) {
infoStr = getString(com.megvii.idcardlib.R.string.face_not_found);
} else if (errorType == FaceQualityErrorType.FACE_POS_DEVIATED) {
infoStr = getString(com.megvii.idcardlib.R.string.face_not_found);
} else if (errorType == FaceQualityErrorType.FACE_NONINTEGRITY) {
infoStr = getString(com.megvii.idcardlib.R.string.face_not_found);
} else if (errorType == FaceQualityErrorType.FACE_TOO_DARK) {
infoStr = getString(com.megvii.idcardlib.R.string.face_too_dark);
} else if (errorType == FaceQualityErrorType.FACE_TOO_BRIGHT) {
infoStr = getString(com.megvii.idcardlib.R.string.face_too_bright);
} else if (errorType == FaceQualityErrorType.FACE_TOO_SMALL) {
infoStr = getString(com.megvii.idcardlib.R.string.face_too_small);
} else if (errorType == FaceQualityErrorType.FACE_TOO_LARGE) {
infoStr = getString(com.megvii.idcardlib.R.string.face_too_large);
} else if (errorType == FaceQualityErrorType.FACE_TOO_BLURRY) {
infoStr = getString(com.megvii.idcardlib.R.string.face_too_blurry);
} else if (errorType == FaceQualityErrorType.FACE_OUT_OF_RECT) {
infoStr = getString(com.megvii.idcardlib.R.string.face_out_of_rect);
}
if (mFailFrame > 10) {
mFailFrame = 0;
promptText.setText(infoStr);
}
}
}
/**
* 跳转Activity传递信息
*/
public void handleResult(final int resID, String delta, Map<String, byte[]> images) {
String resultString = getResources().getString(resID);
// try {
// jsonObject.put("result", resultString);
// jsonObject.put("resultcode", resID);
// } catch (JSONException e) {
// e.printStackTrace();
// }
// Intent intent = new Intent();
// Bundle bundle = new Bundle();
// bundle.putString("result", jsonObject.toString());
// bundle.putString("delta", delta);
// bundle.putSerializable("images", (Serializable) images);
// intent.putExtras(bundle);
// setResult(RESULT_OK, intent);
// finish();
boolean isSuccess = resultString.equals(
getResources().getString(R.string.verify_success));
if (isSuccess){
ArrayList<File> list = new ArrayList<>();
byte[] image_best = images.get("image_best");
byte[] image_env = images.get("image_env");
byte[] image_action1 = images.get("image_action1");
list.add(ConUtil.saveJPG(mActivity, image_best, "image_best"));
list.add(ConUtil.saveJPG(mActivity, image_env, "image_env"));
list.add(ConUtil.saveJPG(mActivity, image_action1, "image_action1"));
mPresenter.commitePhoto(list,delta);
}
}
private int mCurStep = 0;// 检测动作的次数
public void changeType(final DetectionType detectiontype, long timeout) {
// 动画切换
mIDetection.changeType(detectiontype, timeout);
mFaceMask.setFaceInfo(null);
// 语音播放
if (mCurStep == 0) {
mIMediaPlayer.doPlay(mIMediaPlayer.getSoundRes(detectiontype));
} else {
mIMediaPlayer.doPlay(com.megvii.idcardlib.R.raw.meglive_well_done);
mIMediaPlayer.setOnCompletionListener(detectiontype);
}
}
public void handleNotPass(final long remainTime) {
if (remainTime > 0) {
mainHandler.post(new Runnable() {
@Override
public void run() {
timeOutText.setText(remainTime / 1000 + "");
mCircleProgressBar.setProgress((int) (remainTime / 100));
}
});
}
}
private boolean mHasSurface = false;
/**
* TextureView启动成功后 启动相机预览和添加活体检测回调
* (TextureView.SurfaceTextureListener的接口回调方法)
*/
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
mHasSurface = true;
doPreview();
// 添加活体检测回调 (本Activity继承了DetectionListener)
mDetector.setDetectionListener(this);
// 添加相机预览回调(本Activity继承了PreviewCallback)
mICamera.actionDetect(this);
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
}
/**
* TextureView销毁后 (TextureView.SurfaceTextureListener的接口回调方法)
*/
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mHasSurface = false;
return false;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
}
private void doPreview() {
if (!mHasSurface)
return;
mICamera.startPreview(camerapreview.getSurfaceTexture());
}
@Override
public void onPause() {
super.onPause();
mainHandler.removeCallbacksAndMessages(null);
mICamera.closeCamera();
mIMediaPlayer.close();
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mDetector != null)
mDetector.release();
mDialogUtil.onDestory();
mIDetection.onDestroy();
sensorUtil.release();
if (mHandlerThread != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mHandlerThread.quitSafely();
} else {
mHandlerThread.quit();
}
}
}
}
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.dayu.order.ui.activity; ...@@ -2,6 +2,8 @@ package com.dayu.order.ui.activity;
import android.content.Intent; import android.content.Intent;
import android.os.Environment; import android.os.Environment;
import android.text.Editable;
import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -14,6 +16,7 @@ import com.bigkoo.pickerview.listener.OnOptionsSelectListener; ...@@ -14,6 +16,7 @@ import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView; import com.bigkoo.pickerview.view.OptionsPickerView;
import com.dayu.base.ui.activity.BaseActivity; import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.common.MyTextWatcher;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.databinding.ActivityProcessOrderBinding; import com.dayu.order.databinding.ActivityProcessOrderBinding;
import com.dayu.order.presenter.processorder.ProcessOrderContract; import com.dayu.order.presenter.processorder.ProcessOrderContract;
...@@ -32,6 +35,7 @@ import com.luck.picture.lib.entity.LocalMedia; ...@@ -32,6 +35,7 @@ import com.luck.picture.lib.entity.LocalMedia;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
import java.io.File; import java.io.File;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -80,6 +84,46 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -80,6 +84,46 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
mBind.ivDelete.setVisibility(View.GONE); mBind.ivDelete.setVisibility(View.GONE);
mSnImages.clear(); mSnImages.clear();
}); });
initTotal();
}
private void initTotal() {
mBind.etDoorPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mBind.tvTotalMoney.setText(getSum());
}
});
mBind.etServePrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mBind.tvTotalMoney.setText(getSum());
}
});
mBind.etMaterialsPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mBind.tvTotalMoney.setText(getSum());
}
});
mBind.etOtherPrice.addTextChangedListener(new MyTextWatcher() {
@Override
public void afterTextChanged(Editable s) {
mBind.tvTotalMoney.setText(getSum());
}
});
}
public String getSum() {
return new DecimalFormat("0.00").format(parseDb(mBind.etDoorPrice.getText().toString()) + parseDb(mBind.etServePrice.getText().toString()) + parseDb(mBind.etMaterialsPrice.getText().toString()) + parseDb(mBind.etOtherPrice.getText().toString()));
}
public Double parseDb(String str) {
if (TextUtils.isEmpty(str)) {
return 0.0;
} else {
return Double.parseDouble(str);
}
} }
@Override @Override
...@@ -206,8 +250,10 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -206,8 +250,10 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
info.setProductModel(mBind.etVersion.getText().toString()); info.setProductModel(mBind.etVersion.getText().toString());
info.setSn(mBind.etSerialNum.getText().toString()); info.setSn(mBind.etSerialNum.getText().toString());
mPresenter.mOrderField.set(info); mPresenter.mOrderField.set(info);
} }
private void dumpPic(ArrayList<String> list) { private void dumpPic(ArrayList<String> list) {
Intent intent = new Intent(this, PreviewActivty.class); Intent intent = new Intent(this, PreviewActivty.class);
intent.putStringArrayListExtra(Constants.BUNDLE_KEY_ID, list); intent.putStringArrayListExtra(Constants.BUNDLE_KEY_ID, list);
......
package com.dayu.order.ui.activity; package com.dayu.order.ui.activity;
import android.os.Bundle;
import com.alibaba.android.arouter.launcher.ARouter;
import com.dayu.base.ui.activity.DataBindingActivity; import com.dayu.base.ui.activity.DataBindingActivity;
import com.dayu.common.Constants;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.databinding.QrCodeLayoutBinding; import com.dayu.order.databinding.QrCodeLayoutBinding;
import com.dayu.provider.event.RefreshServe;
import com.dayu.provider.router.RouterPath;
import org.greenrobot.eventbus.EventBus;
/** /**
* Created by luofan * Created by luofan
...@@ -17,6 +25,15 @@ public class QrCodeActivity extends DataBindingActivity<QrCodeLayoutBinding> { ...@@ -17,6 +25,15 @@ public class QrCodeActivity extends DataBindingActivity<QrCodeLayoutBinding> {
@Override @Override
public void initView() { public void initView() {
mBind.titleBack.setOnClickListener(v -> finish()); Bundle bundle = getIntent().getBundleExtra(Constants.BUNDLE);
int type = bundle.getInt(Constants.TYPE, 0);
mBind.titleBack.setOnClickListener(v -> {
if (type == 0) {
finish();
} else {
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
EventBus.getDefault().post(new RefreshServe(1));
}
});
} }
} }
...@@ -24,6 +24,7 @@ import com.dayu.order.ui.activity.SubcribeTimeActivity; ...@@ -24,6 +24,7 @@ import com.dayu.order.ui.activity.SubcribeTimeActivity;
import com.dayu.provider.event.RefreshServe; import com.dayu.provider.event.RefreshServe;
import com.dayu.provider.event.RefreshTab; import com.dayu.provider.event.RefreshTab;
import com.dayu.utils.ProgressUtil; import com.dayu.utils.ProgressUtil;
import com.dayu.utils.SPUtils;
import com.dayu.utils.UIUtils; import com.dayu.utils.UIUtils;
import com.dayu.utils.UtilsDate; import com.dayu.utils.UtilsDate;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
...@@ -269,7 +270,7 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -269,7 +270,7 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
mItem = it; mItem = it;
mBind = h; mBind = h;
if ((mItem.getCreatedSource() == 2 || mItem.getCreatedSource() == 3 || mItem.getCreatedSource() == 4) && mItem.getStatus() == 4) { if ((mItem.getCreatedSource() == 2 || mItem.getCreatedSource() == 3 || mItem.getCreatedSource() == 4) && mItem.getStatus() == 4) {
dumpServerActivity(mItem, posiiton); dumpServerActivity(mItem);
} else if (mItem.getStatus() == 4 && mItem.getSubStatus() == 3) { } else if (mItem.getStatus() == 4 && mItem.getSubStatus() == 3) {
dumpProcessActivity(mItem, posiiton); dumpProcessActivity(mItem, posiiton);
} else if (mItem.getStatus() == 4 && mItem.getSubStatus() == 4) { } else if (mItem.getStatus() == 4 && mItem.getSubStatus() == 4) {
...@@ -354,23 +355,28 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -354,23 +355,28 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
MobclickAgent.onEvent(mContext, "process_order"); MobclickAgent.onEvent(mContext, "process_order");
} }
private void dumpServerActivity(Order order, int adapterPosition) { private void dumpServerActivity(Order order) {
Intent intent; Intent intent;
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
if (order.getSpus().size() > 1) { boolean flag = (boolean) SPUtils.get(Constants.ORDER_ID + order.getId(), false);
intent = new Intent(mContext, ServerInfoActivity.class); if (!flag && order.getFaceSwitch() != null && order.getFaceSwitch() == 1) {
bundle.putInt(Constants.ID, order.getId()); mPresenter.dumpToFaceCert(order);
} else if (order.getSpus().size() == 1) {
intent = new Intent(mContext, ServerListActivity.class);
bundle.putInt(Constants.ID, order.getSpus().get(0).getId());
} else { } else {
return; if (order.getSpus().size() > 1) {
} intent = new Intent(mContext, ServerInfoActivity.class);
if (order.getKaCompanyId() != null) { bundle.putInt(Constants.ID, order.getId());
bundle.putInt(OrderConstant.KAADDRESSID, order.getKaCompanyId()); } else if (order.getSpus().size() == 1) {
intent = new Intent(mContext, ServerListActivity.class);
bundle.putInt(Constants.ID, order.getSpus().get(0).getId());
} else {
return;
}
if (order.getKaCompanyId() != null) {
bundle.putInt(OrderConstant.KAADDRESSID, order.getKaCompanyId());
}
intent.putExtra(Constants.BUNDLE, bundle);
mContext.startActivity(intent);
} }
intent.putExtra(Constants.BUNDLE, bundle);
mContext.startActivity(intent);
} }
private void dumpSOPActivity(int id, int adapterPosition) { private void dumpSOPActivity(int id, int adapterPosition) {
......
...@@ -74,5 +74,8 @@ ...@@ -74,5 +74,8 @@
<activity <activity
android:name=".ui.activity.SignatureActivity" android:name=".ui.activity.SignatureActivity"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.OrderLivenessActivity"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>
...@@ -676,6 +676,7 @@ ...@@ -676,6 +676,7 @@
android:textSize="@dimen/sp_13.3" /> android:textSize="@dimen/sp_13.3" />
<TextView <TextView
android:id="@+id/test"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
...@@ -691,11 +692,53 @@ ...@@ -691,11 +692,53 @@
style="@style/line" style="@style/line"
android:layout_below="@id/up_other" /> android:layout_below="@id/up_other" />
<RelativeLayout
android:id="@+id/ll_all_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/image_two_four_lin"
android:layout_marginLeft="@dimen/dp_13.3"
android:layout_marginRight="@dimen/dp_13.3"
android:layout_marginTop="15.7dp"
android:layout_marginBottom="15dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="总金额"
android:textColor="@color/cl_tab_line"
android:textSize="@dimen/sp_13.3" />
<TextView
android:id="@+id/tv_total_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="@string/tv_order_yuan"
android:textColor="@color/cl_tab_line"
android:textSize="@dimen/sp_13.3" />
</RelativeLayout>
<ImageView
android:id="@+id/iv_line_total"
style="@style/line"
android:layout_below="@id/ll_all_money" />
<EditText <EditText
android:id="@+id/et_door_info" android:id="@+id/et_door_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_163" android:layout_height="@dimen/dp_163"
android:layout_below="@id/up_other" android:layout_below="@id/iv_line_total"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/dp_13.3" android:layout_marginLeft="@dimen/dp_13.3"
android:layout_marginRight="@dimen/dp_13.3" android:layout_marginRight="@dimen/dp_13.3"
...@@ -710,46 +753,12 @@ ...@@ -710,46 +753,12 @@
android:textSize="@dimen/sp_13.3" /> android:textSize="@dimen/sp_13.3" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/ll_all_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_pay"
android:layout_marginLeft="@dimen/dp_13.3"
android:layout_marginRight="@dimen/dp_13.3"
android:layout_marginTop="15.7dp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="总金额"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_total_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="元"
android:textStyle="bold" />
</RelativeLayout>
<Button <Button
android:id="@+id/save" android:id="@+id/save"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_below="@id/ll_all_money" android:layout_below="@id/rl_pay"
android:layout_marginLeft="@dimen/dp_14" android:layout_marginLeft="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_33" android:layout_marginTop="@dimen/dp_33"
android:background="@drawable/save_back" android:background="@drawable/save_back"
...@@ -763,7 +772,7 @@ ...@@ -763,7 +772,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_below="@id/ll_all_money" android:layout_below="@id/rl_pay"
android:layout_marginRight="@dimen/dp_16" android:layout_marginRight="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_33" android:layout_marginTop="@dimen/dp_33"
android:background="@drawable/save_submit" android:background="@drawable/save_submit"
......
...@@ -126,15 +126,6 @@ ...@@ -126,15 +126,6 @@
android:orientation="horizontal" /> android:orientation="horizontal" />
</LinearLayout> </LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="43dp"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_17"
android:text="收取费用"
android:textColor="@color/tv_cl"
android:textSize="14sp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="51dp" android:layout_height="51dp"
...@@ -250,6 +241,19 @@ ...@@ -250,6 +241,19 @@
android:text="@string/tv_order_yuan" android:text="@string/tv_order_yuan"
android:textColor="@color/cl_tab_line" android:textColor="@color/cl_tab_line"
android:textSize="@dimen/sp_13.3" /> android:textSize="@dimen/sp_13.3" />
<TextView
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="104dp"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_17"
android:text="收取费用"
android:textColor="@color/tv_cl"
android:textSize="14sp" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
...@@ -345,11 +349,53 @@ ...@@ -345,11 +349,53 @@
style="@style/line" style="@style/line"
android:layout_below="@id/up_other" /> android:layout_below="@id/up_other" />
<RelativeLayout
android:id="@+id/ll_all_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/image_two_four_lin"
android:layout_marginBottom="15dp"
android:layout_marginLeft="@dimen/dp_13.3"
android:layout_marginRight="@dimen/dp_13.3"
android:layout_marginTop="15.7dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="总金额"
android:textColor="@color/cl_tab_line"
android:textSize="@dimen/sp_13.3" />
<TextView
android:id="@+id/tv_total_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="@string/tv_order_yuan"
android:textColor="@color/cl_tab_line"
android:textSize="@dimen/sp_13.3" />
</RelativeLayout>
<ImageView
android:id="@+id/iv_line_total"
style="@style/line"
android:layout_below="@id/ll_all_money" />
<EditText <EditText
android:id="@+id/et_door_info" android:id="@+id/et_door_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_163" android:layout_height="@dimen/dp_163"
android:layout_below="@id/up_other" android:layout_below="@id/iv_line_total"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/dp_13.3" android:layout_marginLeft="@dimen/dp_13.3"
android:layout_marginRight="@dimen/dp_13.3" android:layout_marginRight="@dimen/dp_13.3"
......
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center_horizontal"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_marginTop="100dp"
android:src="@drawable/icon_appointment_code" /> android:src="@drawable/icon_appointment_code" />
<TextView <TextView
...@@ -42,6 +42,14 @@ ...@@ -42,6 +42,14 @@
android:text="@string/scan_code_for_appointment" android:text="@string/scan_code_for_appointment"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/dp_15"
android:text="@string/scan_code_for_appointment_two"
android:textSize="14sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</layout> </layout>
\ No newline at end of file
...@@ -20,4 +20,8 @@ public class RouterPath { ...@@ -20,4 +20,8 @@ public class RouterPath {
public final static String PATH_ORDER_HISTORY = "/order/history"; public final static String PATH_ORDER_HISTORY = "/order/history";
/**
* 用户模块.
*/
public final static String PATH_USER_FACE = "/user/face";
} }
...@@ -62,5 +62,4 @@ dependencies { ...@@ -62,5 +62,4 @@ dependencies {
annotationProcessor "com.alibaba:arouter-compiler:$arouter_compiler_version" annotationProcessor "com.alibaba:arouter-compiler:$arouter_compiler_version"
compile project(':provider') compile project(':provider')
compile project(':IDCardLib') compile project(':IDCardLib')
// compile project(':livenesslib')
} }
...@@ -60,5 +60,7 @@ public interface LoginContract { ...@@ -60,5 +60,7 @@ public interface LoginContract {
*/ */
public abstract void dumpAndSave(UserInfo info); public abstract void dumpAndSave(UserInfo info);
public abstract void getUserInfo(int accountId);
} }
} }
...@@ -9,9 +9,11 @@ import com.dayu.event.UserInfo; ...@@ -9,9 +9,11 @@ import com.dayu.event.UserInfo;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.usercenter.R; import com.dayu.usercenter.R;
import com.dayu.usercenter.api.UserApiFactory; import com.dayu.usercenter.api.UserApiFactory;
import com.dayu.usercenter.data.protocol.EngineerInfo;
import com.dayu.usercenter.ui.activity.AgreementActivity; import com.dayu.usercenter.ui.activity.AgreementActivity;
import com.dayu.usercenter.ui.activity.IdentityCertificationActivity; import com.dayu.usercenter.ui.activity.IdentityCertificationActivity;
import com.dayu.utils.LogUtils; import com.dayu.utils.LogUtils;
import com.dayu.utils.SPUtils;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UIUtils; import com.dayu.utils.UIUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
...@@ -20,6 +22,8 @@ import com.hyphenate.EMCallBack; ...@@ -20,6 +22,8 @@ import com.hyphenate.EMCallBack;
import com.hyphenate.chat.EMClient; import com.hyphenate.chat.EMClient;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
import io.reactivex.functions.Consumer;
/** /**
* Created by luofan * Created by luofan
* on 2017/11/8. * on 2017/11/8.
...@@ -72,6 +76,7 @@ public class LoginPresenter extends LoginContract.Presenter { ...@@ -72,6 +76,7 @@ public class LoginPresenter extends LoginContract.Presenter {
UserApiFactory.login(userName.get(), password.get()).subscribe(baseObserver(userInfo -> { UserApiFactory.login(userName.get(), password.get()).subscribe(baseObserver(userInfo -> {
if (userInfo.getDetectStatus() == 1) { if (userInfo.getDetectStatus() == 1) {
loginHx(userInfo.getHxAccount(), userInfo.getHxPwd()); loginHx(userInfo.getHxAccount(), userInfo.getHxPwd());
getUserInfo(Integer.parseInt(userInfo.getAccountId()));
dumpAndSave(userInfo); dumpAndSave(userInfo);
} }
// else if (userInfo.getDetectStatus() == 2) { // else if (userInfo.getDetectStatus() == 2) {
...@@ -125,6 +130,16 @@ public class LoginPresenter extends LoginContract.Presenter { ...@@ -125,6 +130,16 @@ public class LoginPresenter extends LoginContract.Presenter {
} }
@Override @Override
public void getUserInfo(int accountId) {
UserApiFactory.getEngineerInfo(accountId).subscribe(baseObserver(new Consumer<EngineerInfo>() {
@Override
public void accept(EngineerInfo engineerInfo) throws Exception {
SPUtils.put("USER_IDENTITY", engineerInfo.getIdentity());
}
}));
}
@Override
public void dumpAgreement() { public void dumpAgreement() {
mView.startActivity(AgreementActivity.class); mView.startActivity(AgreementActivity.class);
MobclickAgent.onEvent(BaseApplication.getContext(), "customer_agreement"); MobclickAgent.onEvent(BaseApplication.getContext(), "customer_agreement");
......
...@@ -7,8 +7,10 @@ import android.os.Bundle; ...@@ -7,8 +7,10 @@ import android.os.Bundle;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.dayu.base.ui.activity.BaseActivity; import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.provider.router.RouterPath;
import com.dayu.usercenter.R; import com.dayu.usercenter.R;
import com.dayu.usercenter.common.UserConstant; import com.dayu.usercenter.common.UserConstant;
import com.dayu.usercenter.databinding.ActivityFaceCertificationBinding; import com.dayu.usercenter.databinding.ActivityFaceCertificationBinding;
...@@ -33,7 +35,7 @@ import static android.os.Build.VERSION_CODES.M; ...@@ -33,7 +35,7 @@ import static android.os.Build.VERSION_CODES.M;
* Created by luofan * Created by luofan
* on 2018/5/10. * on 2018/5/10.
*/ */
@Route(path = RouterPath.PATH_USER_FACE)
public class FaceCertificationActivity extends BaseActivity<FaceCertificaitonPresenter, ActivityFaceCertificationBinding> public class FaceCertificationActivity extends BaseActivity<FaceCertificaitonPresenter, ActivityFaceCertificationBinding>
implements FaceCertificaitonContract.View { implements FaceCertificaitonContract.View {
private String uuid; private String uuid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment