Commit 2ee1ca49 by 罗翻

增加处理工单人脸识别

parents 5c86f202 242a5793
Showing with 1889 additions and 181 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);
......
...@@ -34,12 +34,12 @@ public class IDetection { ...@@ -34,12 +34,12 @@ public class IDetection {
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<>();
} }
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)));
} }
...@@ -90,7 +90,7 @@ public class IDetection { ...@@ -90,7 +90,7 @@ public class IDetection {
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);
} }
} }
...@@ -151,17 +151,21 @@ public class IDetection { ...@@ -151,17 +151,21 @@ public class IDetection {
return detectionName; return detectionName;
} }
public void setNum(int n) {
num = n;
}
/** /**
* 初始化检测动作 * 初始化检测动作
*/ */
public void detectionTypeInit() { public void detectionTypeInit() {
ArrayList<DetectionType> tmpTypes = new ArrayList<Detector.DetectionType>(); ArrayList<DetectionType> tmpTypes = new ArrayList<>();
tmpTypes.add(Detector.DetectionType.BLINK);// 眨眼 tmpTypes.add(Detector.DetectionType.BLINK);// 眨眼
tmpTypes.add(Detector.DetectionType.MOUTH);// 张嘴 tmpTypes.add(Detector.DetectionType.MOUTH);// 张嘴
tmpTypes.add(Detector.DetectionType.POS_PITCH);// 缓慢点头 tmpTypes.add(Detector.DetectionType.POS_PITCH);// 缓慢点头
tmpTypes.add(Detector.DetectionType.POS_YAW);// 左右摇头 tmpTypes.add(Detector.DetectionType.POS_YAW);// 左右摇头
Collections.shuffle(tmpTypes);// 打乱顺序 Collections.shuffle(tmpTypes);// 打乱顺序
mDetectionSteps = new ArrayList<DetectionType>(num); mDetectionSteps = new ArrayList<>(num);
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
mDetectionSteps.add(tmpTypes.get(i)); mDetectionSteps.add(tmpTypes.get(i));
} }
......
...@@ -39,7 +39,6 @@ public class Screen { ...@@ -39,7 +39,6 @@ public class Screen {
|| density == 0) { || density == 0) {
Resources res = context.getResources(); Resources res = context.getResources();
DisplayMetrics metrics = res.getDisplayMetrics(); DisplayMetrics metrics = res.getDisplayMetrics();
// TODO // - 50
density = metrics.density; density = metrics.density;
mNotificationBarHeight = (int) (35 * density); mNotificationBarHeight = (int) (35 * density);
mWidth = metrics.widthPixels;// - (int)(50 * density) mWidth = metrics.widthPixels;// - (int)(50 * density)
...@@ -58,7 +57,6 @@ public class Screen { ...@@ -58,7 +57,6 @@ public class Screen {
drawPaddingBottom = density * PADDING_B; drawPaddingBottom = density * PADDING_B;
drawWidth = mWidth - drawPaddingLeft - drawPaddingRight; drawWidth = mWidth - drawPaddingLeft - drawPaddingRight;
// TODO 如果非全屏,�?��减去标题栏的高度
drawHeight = mHeight - drawPaddingTop - drawPaddingBottom; drawHeight = mHeight - drawPaddingTop - drawPaddingBottom;
} }
} }
......
<?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>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/liveness_layout_rootRel" 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:orientation="vertical" > android:orientation="vertical">
<TextureView <TextureView
android:id="@+id/liveness_layout_textureview" android:id="@+id/liveness_layout_textureview"
...@@ -32,33 +34,34 @@ ...@@ -32,33 +34,34 @@
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:layout_below="@id/liveness_layout_head_mask"
android:background="#F6F5F4" > android:background="#F6F5F4">
<include <include
android:id="@+id/activity_main_bottomTitle" android:id="@+id/activity_main_bottomTitle"
layout="@layout/bottom_title_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dip" android:layout_height="40dip"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
layout="@layout/bottom_title_layout" /> android:visibility="gone" />
<include <include
android:id="@+id/liveness_layout_first_layout" android:id="@+id/liveness_layout_first_layout"
layout="@layout/liveness_detection_step"
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_above="@+id/activity_main_bottomTitle"
android:layout_marginBottom="15dip" android:layout_marginBottom="15dip"
android:layout_marginTop="15dip" android:layout_marginTop="15dip"
layout="@layout/liveness_detection_step"
android:visibility="invisible" /> android:visibility="invisible" />
<include <include
android:id="@+id/liveness_layout_second_layout" android:id="@+id/liveness_layout_second_layout"
layout="@layout/liveness_detection_step"
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_above="@+id/activity_main_bottomTitle"
android:layout_marginBottom="15dip" android:layout_marginBottom="15dip"
android:layout_marginTop="15dip" android:layout_marginTop="15dip"
layout="@layout/liveness_detection_step"
android:visibility="gone" /> android:visibility="gone" />
<LinearLayout <LinearLayout
...@@ -69,7 +72,7 @@ ...@@ -69,7 +72,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:gravity="center" android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible" > android:visibility="visible">
<TextView <TextView
android:id="@+id/liveness_layout_promptText" android:id="@+id/liveness_layout_promptText"
...@@ -93,7 +96,7 @@ ...@@ -93,7 +96,7 @@
android:layout_height="35dip" android:layout_height="35dip"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_margin="5dip" android:layout_margin="5dip"
android:visibility="invisible" > android:visibility="invisible">
<TextView <TextView
android:id="@+id/detection_step_timeout_garden" android:id="@+id/detection_step_timeout_garden"
...@@ -119,7 +122,8 @@ ...@@ -119,7 +122,8 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:scaleType="centerInside" android:scaleType="centerInside"
android:src="@drawable/liveness_faceppinside" /> android:src="@drawable/liveness_faceppinside"
android:visibility="gone" />
<ProgressBar <ProgressBar
android:id="@+id/liveness_layout_progressbar" android:id="@+id/liveness_layout_progressbar"
...@@ -128,4 +132,5 @@ ...@@ -128,4 +132,5 @@
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:visibility="invisible" /> android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>
\ No newline at end of file </layout>
\ No newline at end of file
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":11},"path":"app-release.apk","properties":{"packageId":"com.dayu.bigfish","split":"","minSdkVersion":"16"}}] [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":12},"path":"app-release.apk","properties":{"packageId":"com.dayu.bigfish","split":"","minSdkVersion":"16"}}]
\ No newline at end of file \ No newline at end of file
...@@ -148,7 +148,11 @@ public class Api { ...@@ -148,7 +148,11 @@ public class Api {
return Observable.create(e -> { return Observable.create(e -> {
if (response.isSuccess()) { if (response.isSuccess()) {
if (!e.isDisposed()) { if (!e.isDisposed()) {
if (response.getData() != null) {
e.onNext(response.getData()); e.onNext(response.getData());
} else {
e.onError(new ServerException(Constants.ERROR_NULL, ""));
}
} }
} else { } else {
if (!e.isDisposed()) { if (!e.isDisposed()) {
......
...@@ -150,6 +150,9 @@ public class ServerException extends Exception { ...@@ -150,6 +150,9 @@ public class ServerException extends Exception {
case "GLOBAL1005": case "GLOBAL1005":
message = BaseApplication.getContext().getString(R.string.global1005); //数据越界异 message = BaseApplication.getContext().getString(R.string.global1005); //数据越界异
break; break;
case Constants.ERROR_NULL: //数据返回为null
message = Constants.NOT_SHOW;
break;
default: default:
message = BaseApplication.getContext().getString(R.string.get_info_failed); message = BaseApplication.getContext().getString(R.string.get_info_failed);
break; break;
......
...@@ -148,6 +148,9 @@ public class Constants { ...@@ -148,6 +148,9 @@ public class Constants {
public static final String LATITUDE = "latitude"; public static final String LATITUDE = "latitude";
public static final String URL = "url"; public static final String URL = "url";
public static final String ERROR_NULL = "-1";
/** /**
* 主动申请备件. * 主动申请备件.
*/ */
......
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) {
}
}
...@@ -3,6 +3,7 @@ package com.dayu.utils; ...@@ -3,6 +3,7 @@ package com.dayu.utils;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Environment; import android.os.Environment;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -10,6 +11,8 @@ import android.widget.ImageView; ...@@ -10,6 +11,8 @@ import android.widget.ImageView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.dayu.baselibrary.R; import com.dayu.baselibrary.R;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -44,6 +47,23 @@ public class GlideImageLoader { ...@@ -44,6 +47,23 @@ public class GlideImageLoader {
.apply(options) .apply(options)
.into(view); .into(view);
} }
public static void loadDrawable(Context context, String imageRes, ImageView view) {
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.drawable.camera)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true);
Glide.with(context)
.load(imageRes)
.transition(withCrossFade())
.apply(options)
.into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(Drawable drawable, Transition<? super Drawable> transition) {
view.setImageDrawable(drawable);
}
});
}
/** /**
* 压缩图片(质量压缩) * 压缩图片(质量压缩)
......
...@@ -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,12 +63,8 @@ public class UserManager { ...@@ -63,12 +63,8 @@ public class UserManager {
UserInfo userInfo = getUser(); UserInfo userInfo = getUser();
if (userInfo != null) { if (userInfo != null) {
//有数据 //有数据
if (!TextUtils.isEmpty(userInfo.getAccountId()) && !TextUtils.isEmpty(userInfo.getSiteId()) return !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;
} else {
return false;
}
} }
return false; return false;
} }
......
...@@ -8,5 +8,7 @@ ...@@ -8,5 +8,7 @@
<ImageView <ImageView
android:id="@+id/large_image" android:id="@+id/large_image"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="167dp"
android:background="@color/white"
android:scaleType="centerInside" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<TextView
android:id="@+id/title_left"
style="@style/title_left"
android:textSize="14sp" />
<TextView
android:id="@+id/title"
style="@style/text_title" />
<ImageView
android:id="@+id/title_right"
style="@style/title_right_image" />
<ImageView
style="@style/card_line"
android:layout_below="@+id/title_right" />
</RelativeLayout>
</layout>
\ No newline at end of file
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<dimen name="sp_12">12sp</dimen> <dimen name="sp_12">12sp</dimen>
<dimen name="size_order_item_data_text">24sp</dimen> <dimen name="size_order_item_data_text">24sp</dimen>
<dimen name="size_login_button_text">15sp</dimen> <dimen name="size_login_button_text">15sp</dimen>
<dimen name="size_main_title">60dp</dimen> <dimen name="size_main_title">55dp</dimen>
<dimen name="size_title_ml">13.3dp</dimen> <dimen name="size_title_ml">13.3dp</dimen>
<dimen name="size_login_mlcircleimageview_width">80dp</dimen> <dimen name="size_login_mlcircleimageview_width">80dp</dimen>
<dimen name="size_login_mlcircleimageview_height">80dp</dimen> <dimen name="size_login_mlcircleimageview_height">80dp</dimen>
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<string name="wait">等待验收</string> <string name="wait">等待验收</string>
<string name="order_pm">产品</string> <string name="order_pm">产品</string>
<string name="order_pm_text">请输入产品类型</string> <string name="order_pm_text">请输入产品类型</string>
<string name="input_product_name">请输入产品名称</string>
<string name="order_pinpai">品牌</string> <string name="order_pinpai">品牌</string>
<string name="order_pinpai_text">请输入品牌</string> <string name="order_pinpai_text">请输入品牌</string>
<string name="order_xinghao">型号</string> <string name="order_xinghao">型号</string>
...@@ -199,6 +200,7 @@ ...@@ -199,6 +200,7 @@
<string name="finish_order">已完成</string> <string name="finish_order">已完成</string>
<string name="order_close">订单关闭</string> <string name="order_close">订单关闭</string>
<string name="personal_customer">个人客户</string> <string name="personal_customer">个人客户</string>
<string name="big_personal_customer">大客户</string>
<string name="enterprise_customer">企业客户</string> <string name="enterprise_customer">企业客户</string>
<string name="no_branch">暂无品牌</string> <string name="no_branch">暂无品牌</string>
<string name="no_model">暂无型号</string> <string name="no_model">暂无型号</string>
...@@ -274,7 +276,8 @@ ...@@ -274,7 +276,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>
...@@ -295,6 +298,7 @@ ...@@ -295,6 +298,7 @@
<string name="sn_num">SN&#160;&#160;&#160;&#160;&#160;&#160;</string> <string name="sn_num">SN&#160;&#160;&#160;&#160;&#160;&#160;</string>
<string name="charge_record">收费记录</string> <string name="charge_record">收费记录</string>
<string name="total_money">总金额数</string> <string name="total_money">总金额数</string>
<string name="total_price">总金额</string>
<string name="door_money">上门费用</string> <string name="door_money">上门费用</string>
<string name="server_money">服务费用</string> <string name="server_money">服务费用</string>
<string name="material_money">材料费用</string> <string name="material_money">材料费用</string>
...@@ -311,8 +315,8 @@ ...@@ -311,8 +315,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>
...@@ -333,7 +337,19 @@ ...@@ -333,7 +337,19 @@
<string name="system_chcek">系统验收</string> <string name="system_chcek">系统验收</string>
<string name="single_server_num">已完成%1$d/共%2$d</string> <string name="single_server_num">已完成%1$d/共%2$d</string>
<string name="server_num">共%1$d项服务</string> <string name="server_num">共%1$d项服务</string>
<string name="company_mobile">联系技术支持</string>
<string name="task_list">任务列表</string>
<string name="process">处理</string>
<string name="no_signature">您还没有签名!</string>
<string name="electronic_signature">电子签名</string>
<string name="signature_again">重新签名</string>
<string name="finish_signature">完成签名</string>
<string name="special_plane">座机</string>
<string name="sn_photo_not_null">序列号和序列号照片不能为空</string>
<string name="can_not_repet_get_money">您上次已经收取过客户费用,请勿重新收取!</string>
<string name="process_order_success">提交验收成功</string>
<string name="signature_name">请先签名!</string>
<string name="click_and_signature">点击此处让客户去签名</string>
...@@ -393,7 +409,7 @@ ...@@ -393,7 +409,7 @@
<string name="submission_of_audit">提交审核</string> <string name="submission_of_audit">提交审核</string>
<string name="title_my_header">我的头像</string> <string name="title_my_header">我的头像</string>
<string name="modify_header_iv">修改头像</string> <string name="modify_header_iv">修改头像</string>
<string name="dayu_bang">大鱼帮</string> <string name="dayu_bang">大鱼帮</string>
<string name="header_pic">头像</string> <string name="header_pic">头像</string>
<string name="person_mobile">手机号码</string> <string name="person_mobile">手机号码</string>
...@@ -436,7 +452,7 @@ ...@@ -436,7 +452,7 @@
<string name="please_upload_yourself_face">请采集您本人的面孔</string> <string name="please_upload_yourself_face">请采集您本人的面孔</string>
<string name="server_error">系统异常,请稍后重试</string> <string name="server_error">系统异常,请稍后重试</string>
<string name="please_upload_identity_front">请上传身份证正面</string> <string name="please_upload_identity_front">请上传身份证正面</string>
<string name="certification_not_pass">您的活检认证暂未通过</string> <string name="certification_not_pass">您的活检认证暂未通过,请重新认证</string>
<string name="certificaiton_import_notice">信息仅用于身份验证,大鱼师傅保障您的信息安全</string> <string name="certificaiton_import_notice">信息仅用于身份验证,大鱼师傅保障您的信息安全</string>
<string name="certificaiton_notice">&#160;1.&#160;&#160;&#160;&#160;请摘下帽子口罩,不要遮挡面部\n <string name="certificaiton_notice">&#160;1.&#160;&#160;&#160;&#160;请摘下帽子口罩,不要遮挡面部\n
2.&#160;&#160;&#160;&#160;保证光线充足,保持水平拍摄\n 2.&#160;&#160;&#160;&#160;保证光线充足,保持水平拍摄\n
...@@ -449,7 +465,7 @@ ...@@ -449,7 +465,7 @@
<string name="error_time_out">连接服务器超时</string> <string name="error_time_out">连接服务器超时</string>
<string name="error_connect">连接服务器失败</string> <string name="error_connect">连接服务器失败</string>
<string name="error_internet">网络错误</string> <string name="error_internet">网络错误</string>
<string name="error_parse">解析错误</string> <string name="error_parse">json解析错误</string>
<string name="error_ssl">证书验证错误</string> <string name="error_ssl">证书验证错误</string>
<string name="error_connect_time">连接超时</string> <string name="error_connect_time">连接超时</string>
<string name="error_unknow">未知错误</string> <string name="error_unknow">未知错误</string>
......
...@@ -5,8 +5,8 @@ buildscript { ...@@ -5,8 +5,8 @@ buildscript {
ext.build_tools_version = "27.0.2" ext.build_tools_version = "27.0.2"
ext.min_sdk_version = 16 ext.min_sdk_version = 16
ext.target_sdk_version = 23 ext.target_sdk_version = 23
ext.version_code = 11 ext.version_code = 12
ext.verson_name = "1.7.0" ext.verson_name = "1.8.0"
ext.gradle_version = '3.0.1' ext.gradle_version = '3.0.1'
ext.isReleaseMinify = true ext.isReleaseMinify = true
ext.isDebugMinify = true ext.isDebugMinify = true
......
...@@ -16,7 +16,7 @@ import com.amap.api.location.AMapLocationListener; ...@@ -16,7 +16,7 @@ import com.amap.api.location.AMapLocationListener;
public class LocationUtils { public class LocationUtils {
private static AMapLocationClient mlocationClient; private static AMapLocationClient mlocationClient;
public static AMapLocation sLocation = null; private static AMapLocation sLocation = null;
private static boolean flag = true; private static boolean flag = true;
private static MyLocationListener mListener; private static MyLocationListener mListener;
private static Handler mHandler; private static Handler mHandler;
...@@ -92,7 +92,7 @@ public class LocationUtils { ...@@ -92,7 +92,7 @@ public class LocationUtils {
@Override @Override
public void onLocationChanged(AMapLocation location) { public void onLocationChanged(AMapLocation location) {
if (location != null && flag) { if (location != null && location.getErrorCode() == 0 && flag) {
flag = false; flag = false;
mlocationClient.stopLocation(); mlocationClient.stopLocation();
sLocation = location; sLocation = location;
...@@ -111,7 +111,9 @@ public class LocationUtils { ...@@ -111,7 +111,9 @@ public class LocationUtils {
*/ */
public static void destroy() { public static void destroy() {
mHandler = null; mHandler = null;
if (mlocationClient != null) {
mlocationClient.onDestroy(); mlocationClient.onDestroy();
}
mListener = null; mListener = null;
} }
......
...@@ -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')
} }
...@@ -12,6 +12,7 @@ import com.dayu.order.api.protocol.ServerInstruction; ...@@ -12,6 +12,7 @@ import com.dayu.order.api.protocol.ServerInstruction;
import com.dayu.order.api.protocol.ShipperCompany; import com.dayu.order.api.protocol.ShipperCompany;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.api.protocol.Tab; import com.dayu.order.api.protocol.Tab;
import com.dayu.order.api.protocol.companyManager;
import java.util.List; import java.util.List;
...@@ -132,4 +133,12 @@ public class OrderApiFactory { ...@@ -132,4 +133,12 @@ public class OrderApiFactory {
public static Observable<Spu> getMultiProcessInfo(int id) { public static Observable<Spu> getMultiProcessInfo(int id) {
return Api.getService(OrderService.class).getMultiProcessInfo(id).compose(Api.applySchedulers()); return Api.getService(OrderService.class).getMultiProcessInfo(id).compose(Api.applySchedulers());
} }
public static Observable<companyManager> getManagerMobile(int companyId, int managerType) {
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());
}
} }
...@@ -12,6 +12,7 @@ import com.dayu.order.api.protocol.ServerInstruction; ...@@ -12,6 +12,7 @@ import com.dayu.order.api.protocol.ServerInstruction;
import com.dayu.order.api.protocol.ShipperCompany; import com.dayu.order.api.protocol.ShipperCompany;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.api.protocol.Tab; import com.dayu.order.api.protocol.Tab;
import com.dayu.order.api.protocol.companyManager;
import com.dayu.order.common.OrderConstant; import com.dayu.order.common.OrderConstant;
import java.util.List; import java.util.List;
...@@ -283,6 +284,7 @@ interface OrderService { ...@@ -283,6 +284,7 @@ interface OrderService {
/** /**
* 单任务多数量提交工单. * 单任务多数量提交工单.
*
* @param body * @param body
* @return * @return
*/ */
...@@ -291,9 +293,26 @@ interface OrderService { ...@@ -291,9 +293,26 @@ interface OrderService {
/** /**
* 查看多任务处理工单信息. * 查看多任务处理工单信息.
*
* @param id * @param id
* @return * @return
*/ */
@GET(OrderConstant.CHECK_PROCESS_MULTI_ORDER) @GET(OrderConstant.CHECK_PROCESS_MULTI_ORDER)
Observable<BaseResponse<Spu>> getMultiProcessInfo(@Path("id") int id); Observable<BaseResponse<Spu>> getMultiProcessInfo(@Path("id") int id);
/**
* 获取技术支持电话
*
* @return
*/
@GET(OrderConstant.COMPAY_MANAGER_MOBILE)
Observable<BaseResponse<companyManager>> getManagerMobile(@Query("companyId") int companyId, @Query("managerType") int managerType);
/**
* 接单活体检测.
*
* @return
*/
@POST(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 接单数
...@@ -52,6 +53,24 @@ public class Order { ...@@ -52,6 +53,24 @@ public class Order {
private int createdSource; private int createdSource;
private List<Spu> spus; private List<Spu> spus;
private Integer commited; private Integer commited;
private Integer kaCompanyId;
private Integer faceSwitch ;//0:关闭;1:打开
public Integer getFaceSwitch() {
return faceSwitch;
}
public void setFaceSwitch(Integer faceSwitch) {
this.faceSwitch = faceSwitch;
}
public Integer getKaCompanyId() {
return kaCompanyId;
}
public void setKaCompanyId(Integer kaCompanyId) {
this.kaCompanyId = kaCompanyId;
}
public Integer getCommited() { public Integer getCommited() {
return commited; return commited;
......
...@@ -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;
...@@ -69,9 +69,36 @@ public class OrderDetail implements Serializable { ...@@ -69,9 +69,36 @@ public class OrderDetail implements Serializable {
private int spuId; private int spuId;
private Integer anyContacts; private Integer anyContacts;
private Integer kaCompanyId; private Integer kaCompanyId;
private Integer createdSource; //1.服务商自己填写的工单2.厂商系统派3.ka系统4.小程序添加的工单 private Integer createdSource; //1.服务商自己填写的工单2.厂商系统派3.ka系统4.多任务
private List<accessories> accessories; private List<accessories> accessories;
private List<Spu> spus; private List<Spu> spus;
private Integer needEsignature;//1:需要2:不需要.
private String esignatureImg;
private Integer payStatus;//或null:未支付 2.已支付3.支付成功4.支付失败
public Integer getPayStatus() {
return payStatus;
}
public void setPayStatus(Integer payStatus) {
this.payStatus = payStatus;
}
public Integer getNeedEsignature() {
return needEsignature;
}
public void setNeedEsignature(Integer needEsignature) {
this.needEsignature = needEsignature;
}
public String getEsignatureImg() {
return esignatureImg;
}
public void setEsignatureImg(String esignatureImg) {
this.esignatureImg = esignatureImg;
}
public List<Spu> getSpus() { public List<Spu> getSpus() {
return spus; return spus;
...@@ -401,11 +428,11 @@ public class OrderDetail implements Serializable { ...@@ -401,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;
} }
...@@ -417,11 +444,11 @@ public class OrderDetail implements Serializable { ...@@ -417,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;
} }
...@@ -449,11 +476,11 @@ public class OrderDetail implements Serializable { ...@@ -449,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;
} }
...@@ -465,11 +492,11 @@ public class OrderDetail implements Serializable { ...@@ -465,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;
} }
......
...@@ -27,7 +27,7 @@ public class Spu implements Serializable, Parcelable { ...@@ -27,7 +27,7 @@ public class Spu implements Serializable, Parcelable {
private String productModel; private String productModel;
private String providerTypeName; private String providerTypeName;
private String time; private String time;
private int status; private int status;//1未完成2已完成
private String brandName; private String brandName;
private String sn; private String sn;
/** /**
...@@ -35,6 +35,24 @@ public class Spu implements Serializable, Parcelable { ...@@ -35,6 +35,24 @@ public class Spu implements Serializable, Parcelable {
*/ */
private String customerCheckComment; private String customerCheckComment;
private List<Pic> listPic; private List<Pic> listPic;
private Integer needSerialNumPic;//1需要;2不需要.
private String serialNumPicUrl;
public Integer getNeedSerialNumPic() {
return needSerialNumPic;
}
public void setNeedSerialNumPic(Integer needSerialNumPic) {
this.needSerialNumPic = needSerialNumPic;
}
public String getSerialNumPicUrl() {
return serialNumPicUrl;
}
public void setSerialNumPicUrl(String serialNumPicUrl) {
this.serialNumPicUrl = serialNumPicUrl;
}
public String getCustomerCheckComment() { public String getCustomerCheckComment() {
return customerCheckComment; return customerCheckComment;
......
package com.dayu.order.api.protocol;
/**
* Created by luofan
* on 2018/6/12.
*/
public class companyManager {
private Integer accountId;
private Integer companyId;
private String createTime;
private String created;
private Integer id;
private Integer managerType;
private String mobile;
private String name;
private String updateTime;
private String updated;
public Integer getAccountId() {
return accountId;
}
public void setAccountId(Integer accountId) {
this.accountId = accountId;
}
public Integer getCompanyId() {
return companyId;
}
public void setCompanyId(Integer companyId) {
this.companyId = companyId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getManagerType() {
return managerType;
}
public void setManagerType(Integer managerType) {
this.managerType = managerType;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getUpdated() {
return updated;
}
public void setUpdated(String updated) {
this.updated = updated;
}
}
...@@ -18,6 +18,7 @@ public class OrderConstant { ...@@ -18,6 +18,7 @@ public class OrderConstant {
public final static String SPU = "spu"; public final static String SPU = "spu";
public final static String CREATEDSOURCE = "created_source"; public final static String CREATEDSOURCE = "created_source";
public final static String KAADDRESSID = "ka_address_id"; public final static String KAADDRESSID = "ka_address_id";
public final static String ORDER_TYPE = "order_type";//0:单任务单数量
/** /**
* 异常单获取. * 异常单获取.
...@@ -146,4 +147,13 @@ public class OrderConstant { ...@@ -146,4 +147,13 @@ public class OrderConstant {
*/ */
public final static String CHECK_PROCESS_MULTI_ORDER = "/api-order/" + "/ordersRelationSpuItem/detail/{id}"; public final static String CHECK_PROCESS_MULTI_ORDER = "/api-order/" + "/ordersRelationSpuItem/detail/{id}";
/**
* 获取技术支持电话.
*/
public final static String COMPAY_MANAGER_MOBILE = "/api-ka-user/" + "companyManager/findCompanyManagerBy";
/**
* 接单活体检测校验.
*/
public final static String FACE_CERTIFICAITON = "/api-third/" +"detect/receiptOrderVerify";
} }
...@@ -3,7 +3,9 @@ package com.dayu.order.presenter.multipleprocess; ...@@ -3,7 +3,9 @@ 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.HashMap; import java.util.HashMap;
/** /**
...@@ -14,12 +16,30 @@ public interface MultipleProcessContract { ...@@ -14,12 +16,30 @@ public interface MultipleProcessContract {
interface View extends BaseView { interface View extends BaseView {
HashMap<String, Object> getParams(); HashMap<String, Object> getParams();
void setRepairType(); void setRepairType();
void initPayerPhotoView(ArrayList<String> list);
void showPayerDialog();
ArrayList<String> getImages();
void showSignature();
void setPayStatus();
void showSelectPayerDialog(OnCloseListener listener);
void showNoPayerDialog();
boolean getSelectPayer();
} }
abstract class Presenter extends BaseListPresenter<View> { abstract class Presenter extends BaseListPresenter<View> {
public abstract void processOrder(); public abstract void processOrder();
public abstract void getOrderInfo(int orderId); public abstract void getOrderInfo(int orderId);
} }
} }
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.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.provider.event.RefreshServe; import com.dayu.provider.event.RefreshServe;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
...@@ -16,10 +21,13 @@ import com.dayu.utils.UserManager; ...@@ -16,10 +21,13 @@ import com.dayu.utils.UserManager;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
/** /**
...@@ -32,12 +40,20 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -32,12 +40,20 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
private ArrayList<Spu> mSpus; private ArrayList<Spu> mSpus;
private int mAccountId; private int mAccountId;
private String mRepairType; private String mRepairType;
private int mOrderType;//1:单任务但数量.
private ArrayList<String> mImages = new ArrayList<>();
private Integer mNeedEsignature;
private String mSignatureUrl;
@Override @Override
public void onAttached() { public void onAttached() {
mAccountId = Integer.parseInt(UserManager.getInstance().getUser().getAccountId()); mAccountId = Integer.parseInt(UserManager.getInstance().getUser().getAccountId());
mSpus = mView.getBundle().getParcelableArrayList(OrderConstant.SPUS); mSpus = mView.getBundle().getParcelableArrayList(OrderConstant.SPUS);
int type = mView.getBundle().getInt(OrderConstant.ORDER_TYPE);
mDatas.set(mSpus); mDatas.set(mSpus);
if (mSpus.size() == 1 && type == 1) {
mOrderType = 1;
}
getOrderInfo(mSpus.get(0).getOrderId()); getOrderInfo(mSpus.get(0).getOrderId());
} }
...@@ -51,18 +67,116 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -51,18 +67,116 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
return mFootDatas; return mFootDatas;
} }
public void process() {
File file = new File(SignatureActivity.path);
if (mNeedEsignature == 1 && !file.exists()) {
ToastUtils.showShortToast(R.string.signature_name);
return;
}
if (mView.getSelectPayer()) {
mView.showNoPayerDialog();
} else {
if (mOrderType == 1) {
mView.showSelectPayerDialog((dialog, confirm) -> {
if (confirm) {
commitePhoto();
}
});
} else {
commitePhoto();
}
}
}
private void commitePhoto() {
MultipartBody.Part[] parts;
ArrayList<String> imageUrl = mView.getImages();
if (imageUrl != null && imageUrl.size() > 0) {
parts = packPhoto(imageUrl);
mView.showDialog();
BaseApiFactory.uploadPhoto(parts).subscribe(baseObserver(list -> {
if (mNeedEsignature == 1) {
mView.showDialog();
File file = new File(SignatureActivity.path);
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
MultipartBody.Part part = MultipartBody.Part.createFormData("fileUpload", file.getName(), requestFile);
BaseApiFactory.uploadPhoto(part).subscribe(baseObserver(
urls -> {
mSignatureUrl = urls.get(0);
processOrder();
}));
} else {
mImages.addAll(list);
processOrder();
}
}));
} else {
if (mNeedEsignature == 1) {
mView.showDialog();
File file = new File(SignatureActivity.path);
RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
MultipartBody.Part part = MultipartBody.Part.createFormData("fileUpload", file.getName(), requestFile);
BaseApiFactory.uploadPhoto(part).subscribe(baseObserver(
urls -> {
mSignatureUrl = urls.get(0);
processOrder();
}));
} else {
processOrder();
}
}
}
private MultipartBody.Part[] packPhoto(List<String> imageUrl) {
ArrayList<File> files = new ArrayList<>();
if (imageUrl != null && imageUrl.size() > 0) {
for (int i = 0; i < imageUrl.size(); i++) {
files.add(new File(imageUrl.get(i)));
}
}
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 @Override
public void processOrder() { public void processOrder() {
mView.showDialog(); mView.showDialog();
HashMap<String, Object> params = mView.getParams(); HashMap<String, Object> params = mView.getParams();
params.put("engineerId", mAccountId); params.put("engineerId", mAccountId);
params.put("id", mSpus.get(0).getOrderId()); params.put("id", mSpus.get(0).getOrderId());
if (mImages.size() > 0) {
StringBuilder str = new StringBuilder();
for (int a = 0; a < mImages.size(); a++) {
if (a == mImages.size() - 1) {
str.append(mImages.get(a));
} else {
str.append(mImages.get(a));
str.append(",");
}
params.put("pics", str);
}
}
params.put("esignatureImg", mSignatureUrl);
JSONObject jsonObject = new JSONObject(params); JSONObject jsonObject = new JSONObject(params);
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(R.string.process_order_success);
if (integer == 6) {
Bundle bundle = new Bundle();
bundle.putInt(Constants.TYPE, 1);
mView.startActivity(QrCodeActivity.class, bundle);
} else {
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
EventBus.getDefault().post(new RefreshServe(1)); EventBus.getDefault().post(new RefreshServe(1));
}
})); }));
} }
...@@ -76,10 +190,24 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter ...@@ -76,10 +190,24 @@ public class MultipleProcessPresenter extends MultipleProcessContract.Presenter
mRepairType = UIUtils.getString(R.string.payer_baowai); mRepairType = UIUtils.getString(R.string.payer_baowai);
} }
mView.setRepairType(); mView.setRepairType();
mNeedEsignature = detail.getNeedEsignature();
if (mNeedEsignature == 1) {
mView.showSignature();
}
Integer isPay = detail.getIsPay();
Integer payState = detail.getPayStatus();
if ((isPay != null && isPay == 2) && (payState == 3 || payState == 2)) {
mView.setPayStatus();
}
})); }));
} }
public String getRepairType() { public String getRepairType() {
return mRepairType; return mRepairType;
} }
public int getOrderType() {
return mOrderType;
}
} }
...@@ -26,12 +26,16 @@ public interface MultiProcessOrderContract { ...@@ -26,12 +26,16 @@ public interface MultiProcessOrderContract {
*/ */
void initPhotoView(ArrayList<String> list); void initPhotoView(ArrayList<String> list);
void initSnPic(String url);
List<String> getImages(); List<String> getImages();
List<String> getSnImages();
} }
abstract class Presenter extends BasePresenter<View> { abstract class Presenter extends BasePresenter<View> {
public abstract void commitOrder(List<String> imageUrl, int id, String info); public abstract void commitOrder(List<String> imageUrl, List<String> snImages, int id, String info);
public abstract void commitPhoto(); public abstract void commitPhoto();
......
...@@ -3,6 +3,7 @@ package com.dayu.order.presenter.multiprocessorder; ...@@ -3,6 +3,7 @@ package com.dayu.order.presenter.multiprocessorder;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import com.dayu.base.api.BaseApiFactory; import com.dayu.base.api.BaseApiFactory;
import com.dayu.common.BaseApplication; import com.dayu.common.BaseApplication;
...@@ -14,6 +15,7 @@ import com.dayu.order.common.OrderConstant; ...@@ -14,6 +15,7 @@ import com.dayu.order.common.OrderConstant;
import com.dayu.order.ui.activity.MultiProcessOrderActivity; import com.dayu.order.ui.activity.MultiProcessOrderActivity;
import com.dayu.order.ui.activity.ServerInstructionActivity; import com.dayu.order.ui.activity.ServerInstructionActivity;
import com.dayu.order.ui.activity.SopWebViewActivity; import com.dayu.order.ui.activity.SopWebViewActivity;
import com.dayu.utils.ToastUtils;
import com.luck.picture.lib.tools.PictureFileUtils; import com.luck.picture.lib.tools.PictureFileUtils;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
...@@ -37,11 +39,13 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen ...@@ -37,11 +39,13 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen
private Spu mSpu; private Spu mSpu;
private ArrayList<String> mImages = new ArrayList<>(); private ArrayList<String> mImages = new ArrayList<>();
private ArrayList<String> mHttpUrl = new ArrayList<>(); private ArrayList<String> mHttpUrl = new ArrayList<>();
private ArrayList<String> mSnHttpUrl = new ArrayList<>();
public ObservableField<Spu> mDetail = new ObservableField<>(); public ObservableField<Spu> mDetail = new ObservableField<>();
public ObservableField<String> mInfo = new ObservableField<>(); public ObservableField<String> mInfo = new ObservableField<>();
public ObservableField<String> mBrandName = new ObservableField<>(); public ObservableField<String> mBrandName = new ObservableField<>();
public ObservableField<String> mSn = new ObservableField<>(); public ObservableField<String> mSn = new ObservableField<>();
public ObservableField<Boolean> mSpuState = new ObservableField<>(); public ObservableField<Boolean> mSpuState = new ObservableField<>();
public ObservableField<Boolean> mIsShowSn = new ObservableField<>(false);
private ArrayList<Spu> mSpus; private ArrayList<Spu> mSpus;
private int mId; private int mId;
...@@ -61,22 +65,32 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen ...@@ -61,22 +65,32 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen
} else { } else {
mSpuState.set(false); mSpuState.set(false);
} }
if (mSpu.getStatus() == 2) {
getInfo(); getInfo();
} // if (mSpu.getStatus() == 2) {
// getInfo();
// }
} }
private void commitOrder(List<String> list) { private void commitOrder(List<String> list, List<String> snList) {
commitOrder(list, mSpu.getId(), mInfo.get()); commitOrder(list, snList, mSpu.getId(), mInfo.get());
PictureFileUtils.deleteCacheDirFile(BaseApplication.getContext()); PictureFileUtils.deleteCacheDirFile(BaseApplication.getContext());
} }
private MultipartBody.Part[] packPhoto(List<String> imageUrl) { private MultipartBody.Part[] packPhoto(List<String> imageUrl, String type) {
ArrayList<File> files = new ArrayList<>(); ArrayList<File> files = new ArrayList<>();
if (type.equals("sn")) {
mSnHttpUrl.clear();
} else {
mHttpUrl.clear();
}
if (imageUrl != null && imageUrl.size() > 0) { if (imageUrl != null && imageUrl.size() > 0) {
for (int i = 0; i < imageUrl.size(); i++) { for (int i = 0; i < imageUrl.size(); i++) {
if (imageUrl.get(i).contains("http")) { if (imageUrl.get(i).contains("http")) {
if (type.equals("sn")) {
mSnHttpUrl.add(imageUrl.get(i));
} else {
mHttpUrl.add(imageUrl.get(i)); mHttpUrl.add(imageUrl.get(i));
}
} else { } else {
files.add(new File(imageUrl.get(i))); files.add(new File(imageUrl.get(i)));
} }
...@@ -94,7 +108,7 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen ...@@ -94,7 +108,7 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen
} }
@Override @Override
public void commitOrder(List<String> imageUrl, int id, String info) { public void commitOrder(List<String> imageUrl, List<String> snImages, int id, String info) {
HashMap<String, Object> params = new HashMap<>(); HashMap<String, Object> params = new HashMap<>();
params.put("customerCheckComment", info); params.put("customerCheckComment", info);
params.put("id", id); params.put("id", id);
...@@ -115,6 +129,11 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen ...@@ -115,6 +129,11 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen
} else { } else {
params.put("pics", null); params.put("pics", null);
} }
if (snImages != null) {
params.put("serialNumPicUrl", snImages.get(0));
} else {
params.put("serialNumPicUrl", null);
}
JSONObject jsonObject = new JSONObject(params); JSONObject jsonObject = new JSONObject(params);
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString()); RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
OrderApiFactory.processMultiOrder(body).subscribe(baseObserver(integer -> doNext())); OrderApiFactory.processMultiOrder(body).subscribe(baseObserver(integer -> doNext()));
...@@ -153,21 +172,58 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen ...@@ -153,21 +172,58 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen
@Override @Override
public void commitPhoto() { public void commitPhoto() {
if (mIsShowSn.get() && (TextUtils.isEmpty(mSn.get()) || mView.getSnImages().size() == 0)) {
ToastUtils.showShortToast(R.string.sn_photo_not_null);
return;
}
mView.showDialog(); mView.showDialog();
MultipartBody.Part[] parts; MultipartBody.Part[] parts;
List<String> imageUrl = mView.getImages(); List<String> imageUrl = mView.getImages();
if (imageUrl != null && imageUrl.size() > 0) { if (imageUrl != null && imageUrl.size() > 0) {
parts = packPhoto(imageUrl); parts = packPhoto(imageUrl, "");
if (parts.length == 0) { if (parts.length == 0) {
commitOrder(mHttpUrl); if (mIsShowSn.get()) {
List<String> images = mView.getSnImages();
MultipartBody.Part[] snParts = packPhoto(images, "sn");
if (mSnHttpUrl.size() == 1) {
commitOrder(mHttpUrl, mSnHttpUrl);
} else {
BaseApiFactory.uploadPhoto(snParts).subscribe(baseObserver(
list -> commitOrder(mHttpUrl, list)));
}
} else {
commitOrder(mHttpUrl, null);
}
} else { } else {
BaseApiFactory.uploadPhoto(parts).subscribe(baseObserver(list -> { BaseApiFactory.uploadPhoto(parts).subscribe(baseObserver(list -> {
list.addAll(0, mHttpUrl); list.addAll(0, mHttpUrl);
commitOrder(list); if (mIsShowSn.get()) {
List<String> images = mView.getSnImages();
MultipartBody.Part[] snParts = packPhoto(images, "sn");
if (mSnHttpUrl.size() == 1) {
commitOrder(list, mSnHttpUrl);
} else {
BaseApiFactory.uploadPhoto(snParts).subscribe(baseObserver(
list1 -> commitOrder(list, list1)));
}
} else {
commitOrder(list, null);
}
})); }));
} }
}else { } else {
commitOrder(null); if (mIsShowSn.get()) {
List<String> images = mView.getSnImages();
MultipartBody.Part[] snParts = packPhoto(images, "sn");
if (mSnHttpUrl.size() == 1) {
commitOrder(null, mSnHttpUrl);
} else {
BaseApiFactory.uploadPhoto(snParts).subscribe(baseObserver(
list -> commitOrder(null, list)));
}
} else {
commitOrder(null, null);
}
} }
} }
...@@ -204,6 +260,12 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen ...@@ -204,6 +260,12 @@ public class MultiProcessOrderPresenter extends MultiProcessOrderContract.Presen
imges.add(pic.getPictureUrl()); imges.add(pic.getPictureUrl());
} }
mView.initPhotoView(imges); mView.initPhotoView(imges);
if (spu.getSerialNumPicUrl() != null) {
mView.initSnPic(spu.getSerialNumPicUrl());
}
if (spu.getNeedSerialNumPic() != null && spu.getNeedSerialNumPic() == 1) {
mIsShowSn.set(true);
}
})); }));
} }
} }
...@@ -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);
}
} else {
ToastUtils.showShortToast(R.string.certification_not_pass);
mView.dumpBack();
}
}, 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_ERROR00004".equals(responeThrowable.subCode)) {
ToastUtils.showShortToast(R.string.server_error);
} else if ("DETECT_ERROR00005".equals(responeThrowable.subCode)) {
ToastUtils.showShortToast(R.string.please_upload_identity_front);
} else {
ToastUtils.showShortToast(R.string.certification_not_pass);
}
mView.dumpBack();
}));
}
}
...@@ -56,7 +56,7 @@ public class OrderServerPresenter extends OrderServerContract.Presenter { ...@@ -56,7 +56,7 @@ public class OrderServerPresenter extends OrderServerContract.Presenter {
@Override @Override
public void dumpToSop(int id) { public void dumpToSop(int id) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
if (mDetails.getCreatedSource() == 4) { if (mDetails.getCreatedSource() == 2 || mDetails.getCreatedSource() == 3 || mDetails.getCreatedSource() == 4) {
bundle.putInt(ORDER_ID, id); bundle.putInt(ORDER_ID, id);
} else { } else {
bundle.putInt(ORDER_ID, mDetails.getId()); bundle.putInt(ORDER_ID, mDetails.getId());
......
...@@ -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);
...@@ -50,6 +52,8 @@ public interface ProcessOrderContract { ...@@ -50,6 +52,8 @@ public interface ProcessOrderContract {
void showNoPayerDialog(); void showNoPayerDialog();
void showSelectPayerDialog(OnCloseListener listener); void showSelectPayerDialog(OnCloseListener listener);
ArrayList<String> getSnImages();
} }
abstract class Presenter extends BasePresenter<View> { abstract class Presenter extends BasePresenter<View> {
...@@ -57,7 +61,6 @@ public interface ProcessOrderContract { ...@@ -57,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
...@@ -77,9 +80,9 @@ public interface ProcessOrderContract { ...@@ -77,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);
/** /**
* 保存订单. * 保存订单.
...@@ -105,6 +108,5 @@ public interface ProcessOrderContract { ...@@ -105,6 +108,5 @@ public interface ProcessOrderContract {
* 显示费用承担方. * 显示费用承担方.
*/ */
public abstract void showPayerDialog(); public abstract void showPayerDialog();
} }
} }
...@@ -17,5 +17,9 @@ public interface ServerInfoContract { ...@@ -17,5 +17,9 @@ public interface ServerInfoContract {
public abstract void getServerInfo(); public abstract void getServerInfo();
public abstract void dumpServerList(int id); public abstract void dumpServerList(int id);
public abstract void callPhone();
public abstract void getPhone();
} }
} }
package com.dayu.order.presenter.serverinfo; package com.dayu.order.presenter.serverinfo;
import android.content.Intent;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import com.dayu.common.Constants; import com.dayu.common.Constants;
...@@ -18,12 +20,19 @@ import java.util.List; ...@@ -18,12 +20,19 @@ import java.util.List;
public class ServerInfoPresenter extends ServerInfoContract.Presenter { public class ServerInfoPresenter extends ServerInfoContract.Presenter {
public ObservableField<Object> mDatas = new ObservableField<>(); public ObservableField<Object> mDatas = new ObservableField<>();
public ObservableField<Object> mHeadDatas = new ObservableField<>(); public ObservableField<Object> mHeadDatas = new ObservableField<>();
public ObservableField<Integer> mCanProcess = new ObservableField(); public ObservableField<Integer> mCanProcess = new ObservableField<>();
public ObservableField<Boolean> mIsShowPhone = new ObservableField<>(false);
private int mId; private int mId;
private Integer mKaId;
private String mPhone;
@Override @Override
public void onAttached() { public void onAttached() {
mId = mView.getBundle().getInt(Constants.ID); mId = mView.getBundle().getInt(Constants.ID);
mKaId = mView.getBundle().getInt(OrderConstant.KAADDRESSID, -1);
if (mKaId != -1) {
getPhone();
}
} }
@Override @Override
...@@ -57,6 +66,28 @@ public class ServerInfoPresenter extends ServerInfoContract.Presenter { ...@@ -57,6 +66,28 @@ public class ServerInfoPresenter extends ServerInfoContract.Presenter {
} }
@Override @Override
public void callPhone() {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + mPhone));
mView.startActivityForIntent(intent);
}
@Override
public void getPhone() {
mView.showDialog();
OrderApiFactory.getManagerMobile(mKaId, 3).subscribe(baseObserver(companyManager -> {
mPhone = companyManager.getMobile();
if (mPhone != null) {
mIsShowPhone.set(true);
}
}, responeThrowable -> {
if (Constants.ERROR_NULL.equals(responeThrowable.subCode)) {
mIsShowPhone.set(false);
}
}));
}
@Override
public void refresh() { public void refresh() {
getServerInfo(); getServerInfo();
} }
......
...@@ -17,5 +17,10 @@ public interface ServerListContract { ...@@ -17,5 +17,10 @@ public interface ServerListContract {
public abstract void getServerList(); public abstract void getServerList();
public abstract void dumpToProcess(); public abstract void dumpToProcess();
public abstract void callPhone();
public abstract void getPhone();
} }
} }
package com.dayu.order.presenter.serverlist; package com.dayu.order.presenter.serverlist;
import android.content.Intent;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import com.dayu.common.Constants; import com.dayu.common.Constants;
...@@ -19,7 +21,11 @@ public class ServerListPresenter extends ServerListContract.Presenter { ...@@ -19,7 +21,11 @@ public class ServerListPresenter extends ServerListContract.Presenter {
public ObservableField<Object> mDatas = new ObservableField<>(); public ObservableField<Object> mDatas = new ObservableField<>();
public ObservableField<Boolean> mCanProcess = new ObservableField<>(); public ObservableField<Boolean> mCanProcess = new ObservableField<>();
public ObservableField<Boolean> mIsShowProcess = new ObservableField<>(); public ObservableField<Boolean> mIsShowProcess = new ObservableField<>();
public ObservableField<Boolean> mIsShowPhone = new ObservableField<>(false);
private int mId; private int mId;
private Integer mKaId;
private String mPhone;
private int mOrderType;
@Override @Override
public ObservableField<Object> getSourceDatas() { public ObservableField<Object> getSourceDatas() {
...@@ -30,16 +36,20 @@ public class ServerListPresenter extends ServerListContract.Presenter { ...@@ -30,16 +36,20 @@ public class ServerListPresenter extends ServerListContract.Presenter {
public void onAttached() { public void onAttached() {
mId = mView.getBundle().getInt(Constants.ID); mId = mView.getBundle().getInt(Constants.ID);
String type = mView.getBundle().getString(OrderConstant.SPUS); String type = mView.getBundle().getString(OrderConstant.SPUS);
mKaId = mView.getBundle().getInt(OrderConstant.KAADDRESSID, -1);
if (mKaId != -1) {
getPhone();
}
if (OrderConstant.SPUS.equals(type)) { if (OrderConstant.SPUS.equals(type)) {
mIsShowProcess.set(false); mIsShowProcess.set(false);
} else { } else {
mIsShowProcess.set(true); mIsShowProcess.set(true);
} }
mView.showDialog();
} }
@Override @Override
public void getServerList() { public void getServerList() {
mView.showDialog();
OrderApiFactory.getServerList(mId).subscribe(baseObserver(spus -> { OrderApiFactory.getServerList(mId).subscribe(baseObserver(spus -> {
mDatas.set(spus); mDatas.set(spus);
boolean flag = true; boolean flag = true;
...@@ -49,14 +59,40 @@ public class ServerListPresenter extends ServerListContract.Presenter { ...@@ -49,14 +59,40 @@ public class ServerListPresenter extends ServerListContract.Presenter {
} }
} }
mCanProcess.set(flag); mCanProcess.set(flag);
if (spus.size() == 1) {
mOrderType = 1;
}
})); }));
} }
@Override @Override
public void dumpToProcess() { public void dumpToProcess() {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putParcelableArrayList(OrderConstant.SPUS,(ArrayList<Spu>)mDatas.get()); bundle.putParcelableArrayList(OrderConstant.SPUS, (ArrayList<Spu>) mDatas.get());
mView.startActivity(MultipleProcessActivity.class,bundle); bundle.putInt(OrderConstant.ORDER_TYPE, mOrderType);
mView.startActivity(MultipleProcessActivity.class, bundle);
}
@Override
public void callPhone() {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + mPhone));
mView.startActivityForIntent(intent);
}
@Override
public void getPhone() {
mView.showDialog();
OrderApiFactory.getManagerMobile(mKaId, 3).subscribe(baseObserver(companyManager -> {
mPhone = companyManager.getMobile();
if (mPhone != null) {
mIsShowPhone.set(true);
}
}, responeThrowable -> {
if (Constants.ERROR_NULL.equals(responeThrowable.subCode)) {
mIsShowPhone.set(false);
}
}));
} }
@Override @Override
......
...@@ -39,6 +39,8 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre ...@@ -39,6 +39,8 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
private ImageView mAddIV; private ImageView mAddIV;
private List<LocalMedia> mSelectList; private List<LocalMedia> mSelectList;
private ArrayList<String> mImages = new ArrayList<>(); private ArrayList<String> mImages = new ArrayList<>();
private ArrayList<String> mSnImages = new ArrayList<>();
private int mPhotoState;//1.服务照片2.sn照片
@Override @Override
public int getLayoutId() { public int getLayoutId() {
...@@ -49,7 +51,24 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre ...@@ -49,7 +51,24 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
@Override @Override
public void initView() { public void initView() {
mSelectList = new ArrayList<>(); mSelectList = new ArrayList<>();
mAddIV.setOnClickListener(v -> showPicDialog()); mAddIV.setOnClickListener(v -> {
mPhotoState = 1;
showPicDialog();
});
mBind.ivSn.setOnClickListener(v -> {
if (mSnImages.size() > 0) {
dumpPic(mSnImages);
} else {
mPhotoState = 2;
showPicDialog();
}
});
mBind.ivDelete.setOnClickListener(v -> {
mBind.ivSn.setImageResource(R.drawable.icon_sn);
mBind.ivDelete.setVisibility(View.GONE);
mSnImages.clear();
});
} }
@Override @Override
...@@ -66,9 +85,15 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre ...@@ -66,9 +85,15 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
} }
public void showPicDialog() { public void showPicDialog() {
int size;
if (mPhotoState == 1) {
size = 5 - mImages.size();
} else {
size = 1 - mSnImages.size();
}
PictureSelectionModel selector = PictureSelector.create(mActivity) PictureSelectionModel selector = PictureSelector.create(mActivity)
.openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo() .openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()
.maxSelectNum(5 - mImages.size())// 最大图片选择数量 int .maxSelectNum(size)// 最大图片选择数量 int
.imageSpanCount(4)// 每行显示个数 int .imageSpanCount(4)// 每行显示个数 int
.selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选 PictureConfig.MULTIPLE or PictureConfig.SINGLE .selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选 PictureConfig.MULTIPLE or PictureConfig.SINGLE
.previewImage(true)// 是否可预览图片 true or false .previewImage(true)// 是否可预览图片 true or false
...@@ -109,6 +134,13 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre ...@@ -109,6 +134,13 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
initPhoto(list, mBind.llImage, mAddIV); initPhoto(list, mBind.llImage, mAddIV);
} }
@Override
public void initSnPic(String url) {
GlideImageLoader.load(mActivity, url, mBind.ivSn);
mBind.ivDelete.setVisibility(View.VISIBLE);
mSnImages.add(url);
}
public void initPhoto(ArrayList<String> list, LinearLayout layout, ImageView mAdd) { public void initPhoto(ArrayList<String> list, LinearLayout layout, ImageView mAdd) {
layout.removeAllViews(); layout.removeAllViews();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
...@@ -150,9 +182,18 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre ...@@ -150,9 +182,18 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
mSelectList = PictureSelector.obtainMultipleResult(data); mSelectList = PictureSelector.obtainMultipleResult(data);
if (mSelectList != null) { if (mSelectList != null) {
for (int a = 0; a < mSelectList.size(); a++) { for (int a = 0; a < mSelectList.size(); a++) {
if (mPhotoState == 1) {
mImages.add(mSelectList.get(a).getCompressPath()); mImages.add(mSelectList.get(a).getCompressPath());
} else {
mSnImages.add(mSelectList.get(a).getCompressPath());
} }
}
if (mPhotoState == 1) {
initPhotoView(mImages); initPhotoView(mImages);
} else {
GlideImageLoader.load(mActivity, mSnImages.get(0), mBind.ivSn);
mBind.ivDelete.setVisibility(View.VISIBLE);
}
} }
break; break;
} }
...@@ -163,4 +204,9 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre ...@@ -163,4 +204,9 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
public List<String> getImages() { public List<String> getImages() {
return mImages; return mImages;
} }
@Override
public List<String> getSnImages() {
return mSnImages;
}
} }
...@@ -58,7 +58,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act ...@@ -58,7 +58,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act
mMultiDetailFragment = MultiOrderDetailFragment.newInstance(detail); mMultiDetailFragment = MultiOrderDetailFragment.newInstance(detail);
orderDatailsServeFragment = OrderDetailsServeFragment.newInstance(detail); orderDatailsServeFragment = OrderDetailsServeFragment.newInstance(detail);
mOrderPartFragment = OrderPartFragment.newInstance(detail); mOrderPartFragment = OrderPartFragment.newInstance(detail);
if (detail.getCreatedSource() == 4) { if (detail.getCreatedSource() == 2 || detail.getCreatedSource() == 3 || detail.getCreatedSource() == 4) {
mFragments.add(mMultiDetailFragment); mFragments.add(mMultiDetailFragment);
} else { } else {
mFragments.add(orderDatailsFragment); mFragments.add(orderDatailsFragment);
...@@ -66,7 +66,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act ...@@ -66,7 +66,7 @@ public class OrderDetailsActivity extends BaseActivity<OrderDetailPresenter, Act
mFragments.add(orderDatailsServeFragment); mFragments.add(orderDatailsServeFragment);
mFragments.add(mOrderPartFragment); mFragments.add(mOrderPartFragment);
mBind.titleBack.setOnClickListener(v -> dumpBack()); mBind.titleBack.setOnClickListener(v -> dumpBack());
if (detail.getCreatedSource() != 3 && detail.getCreatedSource() != 4) { if (detail.getCreatedSource() ==1) {
mBind.btnPart.setVisibility(View.GONE); mBind.btnPart.setVisibility(View.GONE);
mBind.btnServer.setBackgroundResource(R.drawable.detail_end_selector); mBind.btnServer.setBackgroundResource(R.drawable.detail_end_selector);
} }
......
...@@ -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;
...@@ -47,6 +51,7 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -47,6 +51,7 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
private List<LocalMedia> mSelectList; private List<LocalMedia> mSelectList;
private ArrayList<String> mImages = new ArrayList<>(); private ArrayList<String> mImages = new ArrayList<>();
private ArrayList<String> mPayerImages = new ArrayList<>(); private ArrayList<String> mPayerImages = new ArrayList<>();
private ArrayList<String> mSnImages = new ArrayList<>();
private int mPhotoState = 0; //0:payer private int mPhotoState = 0; //0:payer
@Override @Override
...@@ -66,6 +71,59 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -66,6 +71,59 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
mPhotoState = 0; mPhotoState = 0;
showPicDialog(); showPicDialog();
}); });
mBind.ivSn.setOnClickListener(v -> {
if (mSnImages.size() > 0) {
dumpPic(mSnImages);
} else {
mPhotoState = 2;
showPicDialog();
}
});
mBind.ivDelete.setOnClickListener(v -> {
mBind.ivSn.setImageResource(R.drawable.icon_sn);
mBind.ivDelete.setVisibility(View.GONE);
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
...@@ -91,8 +149,10 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -91,8 +149,10 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
int size; int size;
if (mPhotoState == 0) { if (mPhotoState == 0) {
size = 5 - mPayerImages.size(); size = 5 - mPayerImages.size();
} else { } else if (mPhotoState == 1) {
size = 5 - mImages.size(); size = 5 - mImages.size();
} else {
size = 1 - mSnImages.size();
} }
PictureSelectionModel selector = PictureSelector.create(mActivity) PictureSelectionModel selector = PictureSelector.create(mActivity)
.openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo() .openGallery(PictureMimeType.ofImage())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()
...@@ -190,8 +250,10 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -190,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);
...@@ -242,6 +304,11 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -242,6 +304,11 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
} }
@Override @Override
public ArrayList<String> getSnImages() {
return mSnImages;
}
@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) {
...@@ -252,14 +319,21 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac ...@@ -252,14 +319,21 @@ public class ProcessOrderActivity extends BaseActivity<ProcessOrderPresenter, Ac
for (int a = 0; a < mSelectList.size(); a++) { for (int a = 0; a < mSelectList.size(); a++) {
if (mPhotoState == 0) { if (mPhotoState == 0) {
mPayerImages.add(mSelectList.get(a).getCompressPath()); mPayerImages.add(mSelectList.get(a).getCompressPath());
} else { } else if (mPhotoState == 1) {
mImages.add(mSelectList.get(a).getCompressPath()); mImages.add(mSelectList.get(a).getCompressPath());
} else {
mSnImages.add(mSelectList.get(a).getCompressPath());
} }
} }
if (mPhotoState == 0) { if (mPhotoState == 0) {
initPayerPhotoView(mPayerImages); initPayerPhotoView(mPayerImages);
} else { } else if (mPhotoState == 1) {
initPhotoView(mImages); initPhotoView(mImages);
} else {
if (mSnImages.size() > 0) {
GlideImageLoader.load(mActivity, mSnImages.get(0), mBind.ivSn);
mBind.ivDelete.setVisibility(View.VISIBLE);
}
} }
} }
break; break;
......
package com.dayu.order.ui.activity; package com.dayu.order.ui.activity;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
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
...@@ -10,6 +21,8 @@ import com.dayu.order.databinding.QrCodeLayoutBinding; ...@@ -10,6 +21,8 @@ import com.dayu.order.databinding.QrCodeLayoutBinding;
*/ */
public class QrCodeActivity extends DataBindingActivity<QrCodeLayoutBinding> { public class QrCodeActivity extends DataBindingActivity<QrCodeLayoutBinding> {
private int mType;
@Override @Override
public int getLayoutId() { public int getLayoutId() {
return R.layout.qr_code_layout; return R.layout.qr_code_layout;
...@@ -17,6 +30,27 @@ public class QrCodeActivity extends DataBindingActivity<QrCodeLayoutBinding> { ...@@ -17,6 +30,27 @@ 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);
if (bundle != null) {
mType = bundle.getInt(Constants.TYPE, 0);
}
mBind.titleBack.setOnClickListener(v -> goBack());
SpannableString spannableString = new SpannableString(getString(R.string.scan_code_for_appointment_two));
spannableString.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.bg_button)), 3, 7, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mBind.notice.setText(spannableString);
}
@Override
public void onBackPressed() {
goBack();
}
public void goBack() {
if (mType == 0) {
finish();
} else {
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
EventBus.getDefault().post(new RefreshServe(1));
}
} }
} }
...@@ -34,7 +34,7 @@ public class ServerInfoActivity extends BaseActivity<ServerInfoPresenter, Activi ...@@ -34,7 +34,7 @@ public class ServerInfoActivity extends BaseActivity<ServerInfoPresenter, Activi
@Override @Override
public void initView() { public void initView() {
mBind.tvTitle.setText("任务列表"); mBind.tvTitle.setText(getString(R.string.task_list));
ServerInfoAdapter adapter = new ServerInfoAdapter(false); ServerInfoAdapter adapter = new ServerInfoAdapter(false);
mBind.recyclerView.setAdapter(adapter); mBind.recyclerView.setAdapter(adapter);
mBind.tvProcess.setOnClickListener(v -> { mBind.tvProcess.setOnClickListener(v -> {
......
...@@ -35,7 +35,7 @@ public class ServerListActivity extends BaseActivity<ServerListPresenter, Activi ...@@ -35,7 +35,7 @@ public class ServerListActivity extends BaseActivity<ServerListPresenter, Activi
@Override @Override
public void initView() { public void initView() {
mBind.tvTitle.setText("任务列表"); mBind.tvTitle.setText(getString(R.string.task_list));
mBind.tvProcess.setOnClickListener(o -> { mBind.tvProcess.setOnClickListener(o -> {
}); });
mBind.recyclerView.setOnItemClickListener(new OnItemClickListener<Spu, ActivityServerListBinding>() { mBind.recyclerView.setOnItemClickListener(new OnItemClickListener<Spu, ActivityServerListBinding>() {
......
package com.dayu.order.ui.activity;
import android.os.Environment;
import com.dayu.base.ui.activity.DataBindingActivity;
import com.dayu.order.R;
import com.dayu.order.databinding.ActivitySignatureLayoutBinding;
import com.dayu.utils.ToastUtils;
import java.io.File;
import java.io.IOException;
/**
* Created by luofan
* on 2018/6/12.
*/
public class SignatureActivity extends DataBindingActivity<ActivitySignatureLayoutBinding> {
public static String path = Environment.getExternalStorageDirectory() + "/dayu/image/signature.png";
@Override
public int getLayoutId() {
return R.layout.activity_signature_layout;
}
@Override
public void initView() {
mBind.titleRight.setOnClickListener(v -> mBind.view.clear());
mBind.titleBack.setOnClickListener(v -> finish());
mBind.tvSave.setOnClickListener(v -> {
if (mBind.view.isSign()) {
File file = new File(Environment.getExternalStorageDirectory() + "/dayu/image/");
try {
if (!file.exists()) {
file.mkdirs();
}
mBind.view.save(path);
setResult(100);
finish();
} catch (IOException e) {
e.printStackTrace();
}
} else {
ToastUtils.showLongToast(R.string.no_signature);
}
});
}
}
...@@ -13,6 +13,7 @@ import com.dayu.location.base.LocationUtils; ...@@ -13,6 +13,7 @@ import com.dayu.location.base.LocationUtils;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.api.protocol.Order; import com.dayu.order.api.protocol.Order;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.common.OrderConstant;
import com.dayu.order.databinding.FragmentOrderdoingItemBinding; import com.dayu.order.databinding.FragmentOrderdoingItemBinding;
import com.dayu.order.presenter.orderdoing.OrderDoingPresenter; import com.dayu.order.presenter.orderdoing.OrderDoingPresenter;
import com.dayu.order.ui.activity.ProcessOrderActivity; import com.dayu.order.ui.activity.ProcessOrderActivity;
...@@ -23,6 +24,7 @@ import com.dayu.order.ui.activity.SubcribeTimeActivity; ...@@ -23,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;
...@@ -243,10 +245,15 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -243,10 +245,15 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
MobclickAgent.onEvent(mContext, "take_phone", map_ekv); MobclickAgent.onEvent(mContext, "take_phone", map_ekv);
}); });
} }
if (item.getCreatedSource() == 4) { if (item.getCreatedSource() == 2 || item.getCreatedSource() == 3 || item.getCreatedSource() == 4) {
if (TextUtils.isEmpty(item.getSpus().get(0).getKaSpuName())) {
holder.tvOrderDetail.setText(mContext.getString(R.string.no_server));
} else {
holder.tvOrderDetail.setText(item.getSpus().get(0).getKaSpuName());
}
holder.itemTextWeixiu.setText(item.getSpus().get(0).getProviderTypeName()); holder.itemTextWeixiu.setText(item.getSpus().get(0).getProviderTypeName());
holder.itemTextWeixiuLeixing.setText(item.getSpus().get(0).getKaSpuName()); holder.itemTextWeixiuLeixing.setText(item.getSpus().get(0).getCategoryThreeName());
Spu spu = item.getSpus().get(0); Spu spu = item.getSpus().get(0);
holder.tvServerType.setVisibility(View.VISIBLE); holder.tvServerType.setVisibility(View.VISIBLE);
if (item.getSpus().size() > 1) { if (item.getSpus().size() > 1) {
...@@ -267,8 +274,9 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -267,8 +274,9 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
private void processClick(Order it, FragmentOrderdoingItemBinding h, int posiiton) { private void processClick(Order it, FragmentOrderdoingItemBinding h, int posiiton) {
mItem = it; mItem = it;
mBind = h; mBind = h;
if (mItem.getCreatedSource() == 4 && mItem.getStatus() == 4) { //createdsource为2,3,4并且status为4,进行中时跳转到任务列表.
dumpServerActivity(mItem, posiiton); if ((mItem.getCreatedSource() == 2 || mItem.getCreatedSource() == 3 || mItem.getCreatedSource() == 4) && mItem.getStatus() == 4) {
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) {
...@@ -353,9 +361,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -353,9 +361,13 @@ 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();
boolean flag = (boolean) SPUtils.get(Constants.ORDER_ID + order.getId(), false);
if (!flag && order.getFaceSwitch() != null && order.getFaceSwitch() == 1) {
mPresenter.dumpToFaceCert(order);
} else {
if (order.getSpus().size() > 1) { if (order.getSpus().size() > 1) {
intent = new Intent(mContext, ServerInfoActivity.class); intent = new Intent(mContext, ServerInfoActivity.class);
bundle.putInt(Constants.ID, order.getId()); bundle.putInt(Constants.ID, order.getId());
...@@ -365,9 +377,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -365,9 +377,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
} else { } else {
return; return;
} }
if (order.getKaCompanyId() != null) {
bundle.putInt(OrderConstant.KAADDRESSID, order.getKaCompanyId());
}
intent.putExtra(Constants.BUNDLE, bundle); intent.putExtra(Constants.BUNDLE, bundle);
mContext.startActivity(intent); mContext.startActivity(intent);
} }
}
private void dumpSOPActivity(int id, int adapterPosition) { private void dumpSOPActivity(int id, int adapterPosition) {
Intent intent = new Intent(mContext, SopWebViewActivity.class); Intent intent = new Intent(mContext, SopWebViewActivity.class);
......
...@@ -57,7 +57,7 @@ public class OrderFourTabAdapter extends CoreAdapter<Order, FragmentOrderCancleI ...@@ -57,7 +57,7 @@ public class OrderFourTabAdapter extends CoreAdapter<Order, FragmentOrderCancleI
item.getDistrictName() + item.getAddress()); item.getDistrictName() + item.getAddress());
helper.errorState.setText(mContext.getString(R.string.order_cancle)); helper.errorState.setText(mContext.getString(R.string.order_cancle));
if (item.getCreatedSource() == 4) { if (item.getCreatedSource() == 2 || item.getCreatedSource() == 3 || item.getCreatedSource() == 4) {
if (item.getSpus().size() < 1) { if (item.getSpus().size() < 1) {
return; return;
} }
...@@ -70,7 +70,7 @@ public class OrderFourTabAdapter extends CoreAdapter<Order, FragmentOrderCancleI ...@@ -70,7 +70,7 @@ public class OrderFourTabAdapter extends CoreAdapter<Order, FragmentOrderCancleI
helper.serverStyle.setText(result); helper.serverStyle.setText(result);
} else { } else {
String str = UIUtils.getString(R.string.single_server_num); String str = UIUtils.getString(R.string.single_server_num);
String result = String.format(str, spu.getFinNum(), spu.getFinNum()); String result = String.format(str, spu.getFinNum(), spu.getGoodNum());
helper.serverStyle.setText(result); helper.serverStyle.setText(result);
} }
helper.serverStyle.setVisibility(View.VISIBLE); helper.serverStyle.setVisibility(View.VISIBLE);
......
...@@ -98,7 +98,7 @@ public class OrderServerAdapter extends CoreAdapter<OrderDetail.RecordBean, Serv ...@@ -98,7 +98,7 @@ public class OrderServerAdapter extends CoreAdapter<OrderDetail.RecordBean, Serv
} }
} }
if (UIUtils.getString(R.string.check_accept).equals(item.getCommentName()) || UIUtils.getString(R.string.system_chcek).equals(item.getOperation())) { if (UIUtils.getString(R.string.check_accept).equals(item.getCommentName()) || UIUtils.getString(R.string.system_chcek).equals(item.getOperation())) {
if (mDetail.getCreatedSource() == 4) { if (mDetail.getCreatedSource() == 2 || mDetail.getCreatedSource() == 3 || mDetail.getCreatedSource() == 4) {
holder.serverCheck.setVisibility(View.GONE); holder.serverCheck.setVisibility(View.GONE);
} else { } else {
holder.serverCheck.setVisibility(View.VISIBLE); holder.serverCheck.setVisibility(View.VISIBLE);
...@@ -112,7 +112,7 @@ public class OrderServerAdapter extends CoreAdapter<OrderDetail.RecordBean, Serv ...@@ -112,7 +112,7 @@ public class OrderServerAdapter extends CoreAdapter<OrderDetail.RecordBean, Serv
holder.serverCheck.setOnClickListener(v -> presenter.dumpMap(item.getLatitude(), item.getLongitude(), item.getAddress())); holder.serverCheck.setOnClickListener(v -> presenter.dumpMap(item.getLatitude(), item.getLongitude(), item.getAddress()));
} }
if (UIUtils.getString(R.string.check_reason).equals(item.getCommentName())) { if (UIUtils.getString(R.string.check_reason).equals(item.getCommentName())) {
if (mDetail.getCreatedSource() == 4) { if (mDetail.getCreatedSource() == 2 || mDetail.getCreatedSource() == 3 || mDetail.getCreatedSource() == 4) {
if (item.getCommentInfo() != null) { if (item.getCommentInfo() != null) {
holder.serverCheck.setOnClickListener(v -> presenter.dumpToSop(Integer.parseInt(item.getCommentInfo()))); holder.serverCheck.setOnClickListener(v -> presenter.dumpToSop(Integer.parseInt(item.getCommentInfo())));
} }
......
...@@ -70,7 +70,7 @@ public class OrderThreeTabAdapter extends CoreAdapter<ErrorOrder, FragmentOrderE ...@@ -70,7 +70,7 @@ public class OrderThreeTabAdapter extends CoreAdapter<ErrorOrder, FragmentOrderE
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (item.getCreatedSource() == 4) { if (item.getCreatedSource() == 2 || item.getCreatedSource() == 3 || item.getCreatedSource() == 4) {
if (item.getSpus().size() < 1) { if (item.getSpus().size() < 1) {
return; return;
} }
...@@ -83,7 +83,7 @@ public class OrderThreeTabAdapter extends CoreAdapter<ErrorOrder, FragmentOrderE ...@@ -83,7 +83,7 @@ public class OrderThreeTabAdapter extends CoreAdapter<ErrorOrder, FragmentOrderE
helper.serverStyle.setText(result); helper.serverStyle.setText(result);
} else { } else {
String str = UIUtils.getString(R.string.single_server_num); String str = UIUtils.getString(R.string.single_server_num);
String result = String.format(str, spu.getFinNum(), spu.getFinNum()); String result = String.format(str, spu.getFinNum(), spu.getGoodNum());
helper.serverStyle.setText(result); helper.serverStyle.setText(result);
} }
helper.serverStyle.setVisibility(View.VISIBLE); helper.serverStyle.setVisibility(View.VISIBLE);
......
...@@ -2,8 +2,11 @@ package com.dayu.order.ui.fragment; ...@@ -2,8 +2,11 @@ package com.dayu.order.ui.fragment;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import com.dayu.base.ui.adapter.CoreAdapter; import com.dayu.base.ui.adapter.CoreAdapter;
import com.dayu.base.ui.fragment.DataBindingFragment; import com.dayu.base.ui.fragment.DataBindingFragment;
...@@ -19,6 +22,7 @@ import com.dayu.order.databinding.ItemDetailServerInfoBinding; ...@@ -19,6 +22,7 @@ import com.dayu.order.databinding.ItemDetailServerInfoBinding;
import com.dayu.order.ui.activity.PdfWebViewActivity; import com.dayu.order.ui.activity.PdfWebViewActivity;
import com.dayu.order.ui.activity.QrCodeActivity; import com.dayu.order.ui.activity.QrCodeActivity;
import com.dayu.order.ui.activity.ServerInstructionActivity; import com.dayu.order.ui.activity.ServerInstructionActivity;
import com.dayu.utils.GlideImageLoader;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.widgets.listener.OnItemClickListener; import com.dayu.widgets.listener.OnItemClickListener;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
...@@ -93,6 +97,10 @@ public class MultiOrderDetailFragment extends DataBindingFragment<FragmentMultiD ...@@ -93,6 +97,10 @@ public class MultiOrderDetailFragment extends DataBindingFragment<FragmentMultiD
startActivity(new Intent(mActivity, QrCodeActivity.class)); startActivity(new Intent(mActivity, QrCodeActivity.class));
MobclickAgent.onEvent(mActivity, "customer_apponitment"); MobclickAgent.onEvent(mActivity, "customer_apponitment");
}); });
if (detail.getEsignatureImg() == null) {
mBind.customerSignature.setVisibility(View.GONE);
}
mBind.customerSignature.setOnClickListener(v -> imgMax(detail.getEsignatureImg()));
} }
public String getStaus(int staus) { public String getStaus(int staus) {
...@@ -131,4 +139,15 @@ public class MultiOrderDetailFragment extends DataBindingFragment<FragmentMultiD ...@@ -131,4 +139,15 @@ public class MultiOrderDetailFragment extends DataBindingFragment<FragmentMultiD
public int getLayoutId() { public int getLayoutId() {
return R.layout.fragment_multi_detail; return R.layout.fragment_multi_detail;
} }
public void imgMax(String url) {
LayoutInflater inflater = LayoutInflater.from(mActivity);
View imgEntryView = inflater.inflate(R.layout.dialog_image, null);
final AlertDialog dialog = new AlertDialog.Builder(mActivity).create();
ImageView img = imgEntryView.findViewById(R.id.large_image);
GlideImageLoader.loadDrawable(mActivity, url, img);
dialog.setView(imgEntryView);
dialog.show();
imgEntryView.setOnClickListener(paramView -> dialog.cancel());
}
} }
package com.dayu.order.ui.view;
/**
* Created by luofan
* on 2018/6/12.
*/
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.dayu.order.R;
import com.dayu.order.ui.view.glide.SignFileOutputStream;
import com.dayu.order.ui.view.point.DrawPoint;
import com.dayu.order.ui.view.point.PointUtil;
import com.dayu.order.ui.view.point.TimedPoint;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class HandWriteView extends View {
List<TimedPoint> points = new ArrayList<>();
Stack<TimedPoint> cachePoints = new Stack<>();
PointUtil pointUtil = new PointUtil();
private Bitmap mBitmap;
private Canvas mCanvas;
private Paint mPaint;
private boolean isSign = false;
private int mBackColor = Color.TRANSPARENT;
public HandWriteView(Context context) {
this(context, null);
}
public HandWriteView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public HandWriteView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HandWriteView);
int maxWidth = a.getDimensionPixelSize(R.styleable.HandWriteView_paintMaxWidth, 16);
int minWidth = a.getDimensionPixelSize(R.styleable.HandWriteView_paintMinWidth, 8);
int paintColor = a.getColor(R.styleable.HandWriteView_paintColor, Color.BLACK);
pointUtil.setWidth(minWidth, maxWidth);
mPaint = new Paint();
mPaint.setColor(paintColor);
mPaint.setStrokeWidth(10);
mPaint.setAntiAlias(true);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeJoin(Paint.Join.ROUND);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
getParent().requestDisallowInterceptTouchEvent(true);
points.clear();
addPoint(getNewPoint(x, y));
break;
case MotionEvent.ACTION_MOVE:
addPoint(getNewPoint(x, y));
break;
case MotionEvent.ACTION_UP:
isSign = true;
addPoint(getNewPoint(x, y));
getParent().requestDisallowInterceptTouchEvent(false);
break;
}
invalidate();
return true;
}
private TimedPoint getNewPoint(float x, float y) {
if (cachePoints.empty()) {
return new TimedPoint(x, y);
} else return cachePoints.pop().set(x, y);
}
private void recyclePoint(TimedPoint point) {
cachePoints.push(point);
}
@Override
protected void onDraw(Canvas canvas) {
//画背景 如果有需要的话
super.onDraw(canvas);
if (mBitmap != null) {
canvas.drawBitmap(mBitmap, 0, 0, null);
}
}
private void addPoint(TimedPoint point) {
points.add(point);
if (points.size() > 3) {
ensureSignatureBitmap();
TimedPoint s0 = points.get(0);
TimedPoint s1 = points.get(1);
TimedPoint s2 = points.get(2);
TimedPoint s3 = points.get(3);
float cx1 = s1.x + (s2.x - s0.x) / 4;
float cy1 = s1.y + (s2.y - s0.y) / 4;
float cx2 = s2.x - (s3.x - s1.x) / 4;
float cy2 = s2.y - (s3.y - s1.y) / 4;
pointUtil.set(s1, getNewPoint(cx1, cy1), getNewPoint(cx2, cy2), s2);
float originalWidth = mPaint.getStrokeWidth();
float drawSteps = (float) Math.floor(pointUtil.length());
for (int i = 0; i < drawSteps; i++) {
float t = (float) i / drawSteps;
DrawPoint drawPoint = pointUtil.calculate(t);
mPaint.setStrokeWidth(drawPoint.width);
mCanvas.drawPoint(drawPoint.x, drawPoint.y, mPaint);
}
mPaint.setStrokeWidth(originalWidth);
recyclePoint(points.remove(0));
recyclePoint(pointUtil.control1);
recyclePoint(pointUtil.control2);
} else if (points.size() == 1) {
points.add(getNewPoint(point.x, point.y));
}
}
private void ensureSignatureBitmap() {
if (mBitmap == null) {
mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
}
}
/**
* 保存画板
*
* @param path 保存到路劲
*/
public void save(String path) throws IOException {
save(path, false, 0, false);
}
public void save(String path, boolean isEncrypt) throws IOException {
save(path, false, 0, isEncrypt);
}
/**
* 保存画板
*
* @param path 保存到路径
* @param clearBlank 是否清楚空白区域
* @param blank 边缘空白区域
* @param isEncrypt 加密存储,选择加密存储会自动追加后缀为.sign
*/
public void save(String path, boolean clearBlank, int blank, boolean isEncrypt) throws IOException {
Bitmap bitmap = mBitmap;
if (clearBlank) {
bitmap = clearBlank(bitmap, blank);
}
if (isEncrypt) path = path + ".sign";
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos);
byte[] buffer = bos.toByteArray();
if (buffer != null) {
File file = new File(path);
if (file.exists()) {
file.delete();
}
OutputStream outputStream = isEncrypt ? new SignFileOutputStream(file) : new FileOutputStream(file);
outputStream.write(buffer);
outputStream.close();
}
}
/**
* 逐行扫描 清除边界空白。
*
* @param bp
* @param blank 边距留多少个像素
* @return
*/
private Bitmap clearBlank(Bitmap bp, int blank) {
int HEIGHT = bp.getHeight();
int WIDTH = bp.getWidth();
int top = 0, left = 0, right = WIDTH, bottom = HEIGHT;
int[] pixs = new int[WIDTH];
boolean isStop;
for (int y = 0; y < HEIGHT; y++) {
bp.getPixels(pixs, 0, WIDTH, 0, y, WIDTH, 1);
isStop = false;
for (int pix : pixs) {
if (pix != mBackColor) {
top = y;
isStop = true;
break;
}
}
if (isStop) {
break;
}
}
for (int y = HEIGHT - 1; y >= 0; y--) {
bp.getPixels(pixs, 0, WIDTH, 0, y, WIDTH, 1);
isStop = false;
for (int pix : pixs) {
if (pix != mBackColor) {
bottom = y;
isStop = true;
break;
}
}
if (isStop) {
break;
}
}
int scanHeight = bottom - top;
pixs = new int[scanHeight];
for (int x = 0; x < WIDTH; x++) {
bp.getPixels(pixs, 0, 1, x, top, 1, scanHeight);
isStop = false;
for (int pix : pixs) {
if (pix != mBackColor) {
left = x;
isStop = true;
break;
}
}
if (isStop) {
break;
}
}
for (int x = WIDTH - 1; x > 0; x--) {
bp.getPixels(pixs, 0, 1, x, top, 1, scanHeight);
isStop = false;
for (int pix : pixs) {
if (pix != mBackColor) {
right = x;
isStop = true;
break;
}
}
if (isStop) {
break;
}
}
if (blank < 0) {
blank = 0;
}
left = left - blank > 0 ? left - blank : 0;
top = top - blank > 0 ? top - blank : 0;
right = right + blank > WIDTH - 1 ? WIDTH - 1 : right + blank;
bottom = bottom + blank > HEIGHT - 1 ? HEIGHT - 1 : bottom + blank;
return Bitmap.createBitmap(bp, left, top, right - left, bottom - top);
}
public void setPaintColor(int paintColor) {
mPaint.setColor(paintColor);
}
public void setPaintWidth(int mMinWidth, int mMaxWidth) {
if (mMinWidth > 0 && mMaxWidth > 0 && mMinWidth <= mMaxWidth)
pointUtil.setWidth(mMinWidth, mMaxWidth);
}
public void clear() {
if (mBitmap != null && !mBitmap.isRecycled()) {
mBitmap.recycle();
}
mBitmap = null;
ensureSignatureBitmap();
invalidate();
isSign = false;
}
public boolean isSign() {
return isSign;
}
}
\ No newline at end of file
package com.dayu.order.ui.view.glide;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
/**
* @version 1.0
* @auth wastrel
* @date 2018/2/6 13:21
* @copyRight 四川金信石信息技术有限公司
* @since 1.0
*/
public class SignFileInputStream extends FileInputStream {
byte[] BYTE_MAP = new byte[256];
public SignFileInputStream(String name) throws IOException {
this(new File(name));
}
public SignFileInputStream(File file) throws IOException {
super(file);
if (file.length() <= 256) throw new IOException("Not a .sign File");
byte[] magicNum = new byte[2];
super.read(magicNum,0,2);
if (magicNum[0] == 0x1A && magicNum[1] == 0x2A) {
byte[] temp = new byte[256];
super.read(temp, 0, 256);
for (int i = 0; i < temp.length; i++) {
BYTE_MAP[temp[i] & 0xFF] = (byte) i;
}
} else {
throw new IOException("Not a .sign File,Magic num not 0x1A,0x2A");
}
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
int t = super.read(b, off, len);
for (int i = off; i < off + t; i++) {
b[i] = BYTE_MAP[b[i] & 0xFF];
}
return t;
}
}
package com.dayu.order.ui.view.glide;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;
public class SignFileOutputStream extends FileOutputStream {
byte[] BYTE_MAP;
public SignFileOutputStream(String name) throws IOException {
this(new File(name));
}
public SignFileOutputStream(File file) throws IOException {
super(file);
BYTE_MAP = new byte[256];
for (int i = 0; i < 256; i++) {
BYTE_MAP[i] = (byte) i;
}
Random random = new Random();
for (int i = 0; i < BYTE_MAP.length; i++) {
int p = random.nextInt(256);
byte b = BYTE_MAP[i];
BYTE_MAP[i] = BYTE_MAP[p];
BYTE_MAP[p] = b;
}
//write magic num
super.write(new byte[]{0x1A, 0x2A}, 0, 2);
super.write(BYTE_MAP, 0, 256);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
for (int i = off; i < off + len; i++) {
b[i] = BYTE_MAP[b[i] & 0xFF];
}
super.write(b, off, len);
}
}
package com.dayu.order.ui.view.point;
/**
* Created by luofan
* on 2018/6/12.
*/
public class DrawPoint {
public float x;
public float y;
public float width;
public DrawPoint set(float x, float y, float width) {
this.x = x;
this.y = y;
this.width = width;
return this;
}
}
package com.dayu.order.ui.view.point;
/**
* Created by luofan
* on 2018/6/12.
*/
public class PointUtil {
public TimedPoint startPoint;
public TimedPoint control1;
public TimedPoint control2;
public TimedPoint endPoint;
private int mMinWidth = 8;
private int mMaxWidth = 16;
private float mVelocityFilterWeight = 0.9f;
private float mLastVelocity;
private float mLastWidth;
private float mStartWidth;
private float widthDelta;
private DrawPoint drawPoint = new DrawPoint();
public PointUtil() {
}
public void setWidth(int mMinWidth, int mMaxWidth) {
this.mMinWidth = mMinWidth;
this.mMaxWidth = mMaxWidth;
}
public PointUtil set(TimedPoint startPoint, TimedPoint control1,
TimedPoint control2, TimedPoint endPoint) {
this.startPoint = startPoint;
this.control1 = control1;
this.control2 = control2;
this.endPoint = endPoint;
float velocity = startPoint.velocityTo(endPoint);
velocity = Float.isNaN(velocity) ? 0.0f : velocity;
velocity = mVelocityFilterWeight * velocity
+ (1 - mVelocityFilterWeight) * mLastVelocity;
float newWidth = mMinWidth + (mMaxWidth - mMinWidth) / (Math.max(1, velocity));
mLastVelocity = velocity;
widthDelta = newWidth - mLastWidth;
mStartWidth = mLastWidth;
mLastWidth = newWidth;
return this;
}
/**
* 获得贝塞尔曲线的长度
*
* @return
*/
public float length() {
int steps = 10;
float length = 0;
double cx, cy, px = 0, py = 0, xDiff, yDiff;
for (int i = 0; i <= steps; i++) {
float t = (float) i / steps;
cx = point(t, this.startPoint.x, this.control1.x,
this.control2.x, this.endPoint.x);
cy = point(t, this.startPoint.y, this.control1.y,
this.control2.y, this.endPoint.y);
if (i > 0) {
xDiff = cx - px;
yDiff = cy - py;
length += Math.sqrt(xDiff * xDiff + yDiff * yDiff);
}
px = cx;
py = cy;
}
return length;
}
/**
* 求分段的贝塞尔曲线长度。
* //P(t)=p1(1-t)^3+3p2(1-t)^2t+3p3(1-t)t^2+p4t^3;
*
* @param t
* @param start
* @param c1
* @param c2
* @param end
* @return
*/
public double point(float t, float start, float c1, float c2, float end) {
return start * (1.0 - t) * (1.0 - t) * (1.0 - t)
+ 3.0 * c1 * (1.0 - t) * (1.0 - t) * t
+ 3.0 * c2 * (1.0 - t) * t * t
+ end * t * t * t;
}
public DrawPoint calculate(float t) {
float tt = t * t;
float ttt = tt * t;
float u = 1 - t;
float uu = u * u;
float uuu = uu * u;
float x = uuu * this.startPoint.x;
x += 3 * uu * t * this.control1.x;
x += 3 * u * tt * this.control2.x;
x += ttt * this.endPoint.x;
float y = uuu * this.startPoint.y;
y += 3 * uu * t * this.control1.y;
y += 3 * u * tt * this.control2.y;
y += ttt * this.endPoint.y;
return drawPoint.set(x, y, mStartWidth + ttt * widthDelta);
}
}
package com.dayu.order.ui.view.point;
/**
* Created by luofan
* on 2018/6/12.
*/
public class TimedPoint {
public float x;
public float y;
public long timestamp;
public TimedPoint(float x, float y) {
this.x = x;
this.y = y;
this.timestamp = System.currentTimeMillis();
}
public TimedPoint set(float x, float y) {
this.x = x;
this.y = y;
this.timestamp = System.currentTimeMillis();
return this;
}
public float distanceTo(TimedPoint point) {
return (float) Math.sqrt(Math.pow(point.x - x, 2) + Math.pow(point.y - y, 2));
}
public float velocityTo(TimedPoint point) {
long t = point.timestamp - timestamp;
if (t == 0) return 0;
else return distanceTo(point) / t;
}
}
...@@ -71,5 +71,11 @@ ...@@ -71,5 +71,11 @@
android:name=".ui.activity.MultiProcessOrderActivity" android:name=".ui.activity.MultiProcessOrderActivity"
android:windowSoftInputMode="stateVisible|adjustResize" android:windowSoftInputMode="stateVisible|adjustResize"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.SignatureActivity"
android:screenOrientation="landscape" />
<activity
android:name=".ui.activity.OrderLivenessActivity"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>

15.5 KB | W: | H:

25.4 KB | W: | H:

orderCenter/src/main/res/drawable-hdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-hdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-hdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-hdpi/icon_appointment_code.png
  • 2-up
  • Swipe
  • Onion skin

21.5 KB | W: | H:

35.9 KB | W: | H:

orderCenter/src/main/res/drawable-xhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xhdpi/icon_appointment_code.png
  • 2-up
  • Swipe
  • Onion skin

35.6 KB | W: | H:

69.6 KB | W: | H:

orderCenter/src/main/res/drawable-xxhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xxhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xxhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xxhdpi/icon_appointment_code.png
  • 2-up
  • Swipe
  • Onion skin

53.6 KB | W: | H:

104 KB | W: | H:

orderCenter/src/main/res/drawable-xxxhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xxxhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xxxhdpi/icon_appointment_code.png
orderCenter/src/main/res/drawable-xxxhdpi/icon_appointment_code.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -54,15 +54,13 @@ ...@@ -54,15 +54,13 @@
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tv_modify_sop" android:layout_below="@id/tv_modify_sop">
>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cl_white"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/dp_15"
> android:background="@color/cl_white">
<TextView <TextView
android:id="@+id/tv_product_title" android:id="@+id/tv_product_title"
...@@ -71,7 +69,7 @@ ...@@ -71,7 +69,7 @@
android:background="@color/tv_bg" android:background="@color/tv_bg"
android:paddingLeft="@dimen/dp_15" android:paddingLeft="@dimen/dp_15"
android:paddingTop="18dp" android:paddingTop="18dp"
android:text="产品信息" android:text="@string/prodcut_info"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -80,8 +78,7 @@ ...@@ -80,8 +78,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_product_title" android:layout_below="@+id/tv_product_title"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10">
>
<RelativeLayout <RelativeLayout
android:id="@+id/rl_product" android:id="@+id/rl_product"
...@@ -111,7 +108,7 @@ ...@@ -111,7 +108,7 @@
android:layout_marginLeft="90dp" android:layout_marginLeft="90dp"
android:layout_toEndOf="@+id/text_one_text" android:layout_toEndOf="@+id/text_one_text"
android:layout_toRightOf="@+id/text_one_text" android:layout_toRightOf="@+id/text_one_text"
android:hint="请输入产品名称" android:hint="@string/input_product_name"
android:text="@{presenter.mDetail.categoryThreeName??@string/now_no}" android:text="@{presenter.mDetail.categoryThreeName??@string/now_no}"
android:textColor="@color/cl_selector_hui" android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" /> android:textSize="@dimen/sp_15" />
...@@ -146,9 +143,9 @@ ...@@ -146,9 +143,9 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="90dp" android:layout_marginLeft="90dp"
android:layout_toRightOf="@id/text_two_text" android:layout_toRightOf="@id/text_two_text"
android:background="@null"
android:hint="@string/order_brand_name" android:hint="@string/order_brand_name"
android:text="@={presenter.mBrandName}" android:text="@={presenter.mBrandName}"
android:background="@null"
android:textColor="@color/cl_selector_hui" android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" /> android:textSize="@dimen/sp_15" />
...@@ -211,6 +208,16 @@ ...@@ -211,6 +208,16 @@
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_15" /> android:textSize="@dimen/sp_15" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/tv_serial_num"
android:text="*"
android:textColor="#F74848"
android:textSize="@dimen/sp_15"
android:visibility="@{presenter.mIsShowSn?View.VISIBLE:View.GONE}" />
<EditText <EditText
android:id="@+id/et_serial_num" android:id="@+id/et_serial_num"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -218,9 +225,9 @@ ...@@ -218,9 +225,9 @@
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="75dp" android:layout_marginLeft="75dp"
android:layout_toRightOf="@id/tv_serial_num" android:layout_toRightOf="@id/tv_serial_num"
android:background="@null"
android:hint="@string/order_serail_hint" android:hint="@string/order_serail_hint"
android:text="@={presenter.mSn}" android:text="@={presenter.mSn}"
android:background="@null"
android:textColor="@color/cl_selector_hui" android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_15" /> android:textSize="@dimen/sp_15" />
</RelativeLayout> </RelativeLayout>
...@@ -230,11 +237,38 @@ ...@@ -230,11 +237,38 @@
style="@style/line" style="@style/line"
android:layout_below="@id/rl_serial_num" /> android:layout_below="@id/rl_serial_num" />
<RelativeLayout
android:id="@+id/ll_sn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/line_serial"
android:orientation="horizontal"
android:visibility="@{presenter.mIsShowSn?View.VISIBLE:View.GONE}">
<ImageView
android:id="@+id/iv_sn"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginBottom="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
android:src="@drawable/icon_sn" />
<ImageView
android:id="@+id/iv_delete"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="95dp"
android:layout_marginTop="@dimen/dp_15"
android:src="@drawable/img_photo_delete"
android:visibility="gone" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/tv_server_info" android:id="@+id/tv_server_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="43dp" android:layout_height="43dp"
android:layout_below="@+id/line_serial" android:layout_below="@+id/ll_sn"
android:background="@color/tv_bg" android:background="@color/tv_bg"
android:paddingLeft="@dimen/dp_15" android:paddingLeft="@dimen/dp_15"
android:paddingTop="18dp" android:paddingTop="18dp"
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
android:layout_height="43dp" android:layout_height="43dp"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:paddingTop="@dimen/dp_17" android:paddingTop="@dimen/dp_17"
android:text="工单概况" android:text="@string/tv_order_eg"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@color/bg_button" android:background="@color/bg_button"
android:gravity="center" android:gravity="center"
android:onClick="@{()->presenter.processOrder()}" android:onClick="@{()->presenter.process()}"
android:text="提交验收" android:text="@string/submit_order"
android:textColor="@color/white" /> android:textColor="@color/white" />
</RelativeLayout> </RelativeLayout>
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<variable <variable
name="presenter" name="presenter"
type="com.dayu.order.presenter.serverinfo.ServerInfoPresenter" /> type="com.dayu.order.presenter.serverinfo.ServerInfoPresenter" />
<import type="android.view.View" />
</data> </data>
<RelativeLayout <RelativeLayout
...@@ -24,9 +26,16 @@ ...@@ -24,9 +26,16 @@
<ImageView <ImageView
android:id="@+id/receiving_back" android:id="@+id/receiving_back"
style="@style/title_image_back" style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}" android:onClick="@{()->presenter.dumpBack()}" />
/> <TextView
android:id="@+id/tv_right_title"
style="@style/title_right_text"
android:onClick="@{()->presenter.callPhone()}"
android:text="@string/company_mobile"
android:textColor="#3faafc"
android:textSize="@dimen/dp_13.3"
android:visibility="@{presenter.mIsShowPhone?View.VISIBLE:View.GONE}" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
...@@ -52,7 +61,7 @@ ...@@ -52,7 +61,7 @@
android:background='@{presenter.mCanProcess==2?@color/bg_button:@color/cl_selector_hui}' android:background='@{presenter.mCanProcess==2?@color/bg_button:@color/cl_selector_hui}'
android:clickable='@{presenter.mCanProcess==2?true:false}' android:clickable='@{presenter.mCanProcess==2?true:false}'
android:gravity="center" android:gravity="center"
android:text="提交验收" android:text="@string/submit_order"
android:textColor="@color/white" /> android:textColor="@color/white" />
</RelativeLayout> </RelativeLayout>
</layout> </layout>
\ No newline at end of file
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/iv_arrow" android:layout_toLeftOf="@+id/iv_arrow"
android:text='@{item.status==1?"处理":"已完成"}' android:text='@{item.status==1?@string/process:@string/order_finish}'
android:textColor="@color/bg_button" android:textColor="@color/bg_button"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
......
...@@ -31,9 +31,16 @@ ...@@ -31,9 +31,16 @@
<ImageView <ImageView
android:id="@+id/receiving_back" android:id="@+id/receiving_back"
style="@style/title_image_back" style="@style/title_image_back"
android:onClick="@{()->presenter.dumpBack()}" android:onClick="@{()->presenter.dumpBack()}" />
/> <TextView
android:id="@+id/tv_right_title"
style="@style/title_right_text"
android:onClick="@{()->presenter.callPhone()}"
android:text="@string/company_mobile"
android:textColor="#3faafc"
android:visibility="@{presenter.mIsShowPhone?View.VISIBLE:View.GONE}"
android:textSize="@dimen/dp_13.3" />
</RelativeLayout> </RelativeLayout>
<ImageView style="@style/card_line" /> <ImageView style="@style/card_line" />
...@@ -59,7 +66,7 @@ ...@@ -59,7 +66,7 @@
android:clickable='@{presenter.mCanProcess?true:false}' android:clickable='@{presenter.mCanProcess?true:false}'
android:onClick="@{()->presenter.dumpToProcess()}" android:onClick="@{()->presenter.dumpToProcess()}"
android:gravity="center" android:gravity="center"
android:text="提交验收" android:text="@string/submit_order"
android:textColor="@color/white" android:textColor="@color/white"
android:visibility="@{presenter.mIsShowProcess?View.VISIBLE:View.GONE}" /> android:visibility="@{presenter.mIsShowProcess?View.VISIBLE:View.GONE}" />
</RelativeLayout> </RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout style="@style/title">
<ImageView
android:id="@+id/title_back"
style="@style/title_image_back" />
<TextView
style="@style/text_title"
android:text="@string/electronic_signature" />
<TextView
android:id="@+id/title_right"
style="@style/title_right_text"
android:text="@string/signature_again" />
</RelativeLayout>
<ImageView style="@style/card_line" />
<com.dayu.order.ui.view.HandWriteView
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="@dimen/dp_8"
android:background="@color/white"
android:layout_weight="1"
app:paintColor="@color/tv_cl"
app:paintMaxWidth="20px"
app:paintMinWidth="10px" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center">
<TextView
android:id="@+id/tv_save"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/bg_button"
android:text="@string/finish_signature"
android:gravity="center"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</layout>
\ No newline at end of file
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
android:layout_height="43dp" android:layout_height="43dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingTop="@dimen/dp_15" android:paddingTop="@dimen/dp_15"
android:text="工单概况" android:text="@string/tv_order_eg"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -262,6 +262,21 @@ ...@@ -262,6 +262,21 @@
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/customer_signature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_below="@+id/tv_customer_type"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/dp_15"
android:gravity="right"
android:layout_marginTop="@dimen/dp_15"
android:layout_toRightOf="@+id/customer_name"
android:text="查看签名"
android:textColor="@color/bg_button"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_customer_mobile" android:id="@+id/tv_customer_mobile"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:text="接单超时"
android:textColor="@color/cl_order_item_line_bg" android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/size_login_hint_text" android:textSize="@dimen/size_login_hint_text"
android:visibility="visible" /> android:visibility="visible" />
......
...@@ -715,7 +715,8 @@ ...@@ -715,7 +715,8 @@
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="@drawable/tab_blue_react" android:background="@drawable/tab_blue_react"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:text="接单超时"
android:textColor="@color/cl_tab_read" android:textColor="@color/cl_tab_read"
android:textSize="@dimen/size_login_hint_text" android:textSize="@dimen/size_login_hint_text"
android:visibility="visible" /> android:visibility="visible" />
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="18dp" android:layout_marginBottom="18dp"
android:text="服务说明" android:text="@string/order_instruction"
android:textColor="@color/bg_button" android:textColor="@color/bg_button"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="15sp" android:layout_marginRight="15sp"
android:text='@{item.status==1?"处理":"已完成"}' android:text='@{item.status==1?@string/process:@string/order_finish}'
android:textColor="@color/bg_button" android:textColor="@color/bg_button"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
</RelativeLayout> </RelativeLayout>
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
android:id="@+id/tv_repair_type" android:id="@+id/tv_repair_type"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="安装"
android:textColor="@color/cl_tab_init" android:textColor="@color/cl_tab_init"
android:textSize="13sp" /> android:textSize="13sp" />
...@@ -83,7 +82,6 @@ ...@@ -83,7 +82,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/tv_repair_type" android:layout_toRightOf="@id/tv_repair_type"
android:text="-平板电视"
android:textColor="@color/cl_tab_init" android:textColor="@color/cl_tab_init"
android:textSize="13sp" /> android:textSize="13sp" />
...@@ -102,7 +100,6 @@ ...@@ -102,7 +100,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_repair_type" android:layout_below="@+id/tv_repair_type"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="服务方式"
android:textColor="@color/cl_tab_init" android:textColor="@color/cl_tab_init"
android:textSize="13sp" /> android:textSize="13sp" />
...@@ -112,7 +109,6 @@ ...@@ -112,7 +109,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_server_type" android:layout_below="@+id/tv_server_type"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:text="服务要求"
android:textColor="@color/cl_tab_init" android:textColor="@color/cl_tab_init"
android:textSize="13sp" /> android:textSize="13sp" />
</RelativeLayout> </RelativeLayout>
...@@ -130,7 +126,7 @@ ...@@ -130,7 +126,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="39dp" android:layout_height="39dp"
android:gravity="center" android:gravity="center"
android:text="处理" android:text="@string/process"
android:textColor="@color/bg_button" android:textColor="@color/bg_button"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
......
...@@ -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,15 @@ ...@@ -42,6 +42,15 @@
android:text="@string/scan_code_for_appointment" android:text="@string/scan_code_for_appointment"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView
android:id="@+id/notice"
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
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
android:layout_height="43dp" android:layout_height="43dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingTop="@dimen/dp_18" android:paddingTop="@dimen/dp_18"
android:text="顾客信息" android:text="@string/customer_info"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="18dp" android:layout_marginTop="18dp"
android:text="客户类型" android:text="@string/customer_type"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginTop="18dp" android:layout_marginTop="18dp"
android:text='@{item.customerType==1?"个人客户":"大客户"}' android:text='@{item.customerType==1?@string/personal_customer:@string/big_personal_customer}'
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_type" android:layout_below="@+id/tv_type"
android:layout_marginTop="14dp" android:layout_marginTop="14dp"
android:text="客户姓名" android:text="@string/customer_name"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_name" android:layout_below="@+id/tv_name"
android:layout_marginTop="14dp" android:layout_marginTop="14dp"
android:text="联系方式" android:text="@string/ka_mobile"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_mobile" android:layout_below="@+id/tv_mobile"
android:layout_marginTop="14dp" android:layout_marginTop="14dp"
android:text="座机" android:text="@string/special_plane"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_phone" android:layout_below="@+id/tv_phone"
android:layout_marginTop="14dp" android:layout_marginTop="14dp"
android:text="客户地址" android:text="@string/tv_two_text_foure"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
android:layout_below="@+id/tv_address" android:layout_below="@+id/tv_address"
android:layout_marginBottom="@dimen/dp_15" android:layout_marginBottom="@dimen/dp_15"
android:layout_marginTop="14dp" android:layout_marginTop="14dp"
android:text="预约时间" android:text="@string/appointment_time"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
android:layout_height="43dp" android:layout_height="43dp"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingTop="@dimen/dp_18" android:paddingTop="@dimen/dp_18"
android:text="任务列表" android:text="@string/task_list"
android:textColor="@color/tv_cl" android:textColor="@color/tv_cl"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12" android:layout_marginLeft="@dimen/dp_12"
android:layout_weight="1" android:layout_weight="1"
android:text="【系统验收】"
android:textColor="@color/default_text_color" android:textColor="@color/default_text_color"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
...@@ -49,7 +48,6 @@ ...@@ -49,7 +48,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:text="2017-08-04 14:47"
android:textColor="@color/default_text_color" android:textColor="@color/default_text_color"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
...@@ -62,7 +60,6 @@ ...@@ -62,7 +60,6 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_12" android:layout_marginTop="@dimen/dp_12"
android:text="系统进行了验收费"
android:textColor="@color/default_text_color" android:textColor="@color/default_text_color"
android:textSize="12sp" /> android:textSize="12sp" />
...@@ -72,7 +69,6 @@ ...@@ -72,7 +69,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_20"
android:text="预约时间:2017-12-11 18:30:00"
android:textColor="@color/default_text_color" android:textColor="@color/default_text_color"
android:textSize="12sp" /> android:textSize="12sp" />
...@@ -83,7 +79,6 @@ ...@@ -83,7 +79,6 @@
android:layout_height="22dp" android:layout_height="22dp"
android:gravity="center" android:gravity="center"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_20"
android:text="查看请"
android:textColor="@color/default_text_color" android:textColor="@color/default_text_color"
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="HandWriteView">
<attr name="paintColor" format="color"/>
<attr name="paintMaxWidth" format="dimension"/>
<attr name="paintMinWidth" format="dimension"/>
</declare-styleable>
</resources>
\ No newline at end of file
...@@ -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')
} }
...@@ -67,10 +67,19 @@ public class UserConstant { ...@@ -67,10 +67,19 @@ public class UserConstant {
*/ */
public final static String PERSON_LICENCES = "/api-user/" + "licenceInfo/accountId/{accountId}"; public final static String PERSON_LICENCES = "/api-user/" + "licenceInfo/accountId/{accountId}";
/**
* 获取个人资质.
*/
public final static String PERSON_LICENCE = "/api-user/" + "licenceInfo/{id}"; public final static String PERSON_LICENCE = "/api-user/" + "licenceInfo/{id}";
/**
* 身份证识别.
*/
public final static String IDENTITY_OCR = "/api-detect/" + "detect/cardOcr"; public final static String IDENTITY_OCR = "/api-detect/" + "detect/cardOcr";
/**
* 活体检测.
*/
public final static String FACE_OCR = "/api-user/" + "/accountExt/engineerMegLiveVerify"; public final static String FACE_OCR = "/api-user/" + "/accountExt/engineerMegLiveVerify";
} }
package com.dayu.usercenter.data.protocol; package com.dayu.usercenter.data.protocol;
/** /**
* Created by luofan on 2017/11/14. * Created by luofan
* on 2017/11/14.
*/ */
public class TodayAchievement { public class TodayAchievement {
private int achievement; private double achievement;
public int getAchievement() { public double getAchievement() {
return achievement; return achievement;
} }
public void setAchievement(int achievement) { public void setAchievement(double achievement) {
this.achievement = achievement; this.achievement = achievement;
} }
} }
...@@ -89,14 +89,13 @@ public class FaceCertificaitonPresenter extends FaceCertificaitonContract.Presen ...@@ -89,14 +89,13 @@ public class FaceCertificaitonPresenter extends FaceCertificaitonContract.Presen
bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.please_upload_cleare_identity)); bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.please_upload_cleare_identity));
}else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) { }else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) {
bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.please_upload_yourself_face)); bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.please_upload_yourself_face));
} else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) { } else if ("DETECT_ERROR00004".equals(responeThrowable.subCode)) {
bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.server_error)); bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.server_error));
} else if ("DETECT_ERROR00003".equals(responeThrowable.subCode)) { } else if ("DETECT_ERROR00005".equals(responeThrowable.subCode)) {
bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.please_upload_identity_front)); bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.please_upload_identity_front));
} else { } else {
bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.certification_not_pass)); bundle.putString(UserConstant.DETECT_STATE, UIUtils.getString(R.string.certification_not_pass));
} }
mView.startActivity(CertificationResultActivity.class, bundle); mView.startActivity(CertificationResultActivity.class, bundle);
})); }));
} }
......
...@@ -2,7 +2,6 @@ package com.dayu.usercenter.presenter.login; ...@@ -2,7 +2,6 @@ package com.dayu.usercenter.presenter.login;
import com.dayu.base.ui.presenter.BasePresenter; import com.dayu.base.ui.presenter.BasePresenter;
import com.dayu.event.UserInfo;
import com.dayu.common.BaseView; import com.dayu.common.BaseView;
import com.dayu.widgets.listener.OnCloseListener; import com.dayu.widgets.listener.OnCloseListener;
...@@ -54,11 +53,12 @@ public interface LoginContract { ...@@ -54,11 +53,12 @@ public interface LoginContract {
public abstract void loginHx(String hxAccount, String hxPwd); public abstract void loginHx(String hxAccount, String hxPwd);
/** /**
* 跳转到主界面并保存用户信息. * 跳转到主界面.
* *
* @param info
*/ */
public abstract void dumpAndSave(UserInfo info); public abstract void dump();
public abstract void getUserInfo(int accountId);
} }
} }
...@@ -5,13 +5,13 @@ import android.text.TextUtils; ...@@ -5,13 +5,13 @@ import android.text.TextUtils;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.dayu.common.BaseApplication; import com.dayu.common.BaseApplication;
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.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;
...@@ -72,16 +72,13 @@ public class LoginPresenter extends LoginContract.Presenter { ...@@ -72,16 +72,13 @@ 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());
dumpAndSave(userInfo); UserManager.getInstance().saveUser(userInfo);
} mView.showDialog();
// else if (userInfo.getDetectStatus() == 2) { getUserInfo(Integer.parseInt(userInfo.getAccountId()));
// ToastUtils.showShortToast(R.string.engineer_identity_auditing); } else if (userInfo.getDetectStatus() == 2 || userInfo.getDetectStatus() == 3) {
// UserManager.getInstance().saveUser(userInfo);
// }
else if (userInfo.getDetectStatus() == 2 || userInfo.getDetectStatus() == 3) {
showLoginDialog(); showLoginDialog();
UserManager.getInstance().saveUser(userInfo); UserManager.getInstance().saveUser(userInfo);
}else { } else {
ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile)); ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile));
} }
})); }));
...@@ -118,10 +115,16 @@ public class LoginPresenter extends LoginContract.Presenter { ...@@ -118,10 +115,16 @@ public class LoginPresenter extends LoginContract.Presenter {
} }
@Override @Override
public void dumpAndSave(UserInfo info) { public void dump() {
UserManager.getInstance().saveUser(info);
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
// mView.startActivity(TestActivity.class); }
@Override
public void getUserInfo(int accountId) {
UserApiFactory.getEngineerInfo(accountId).subscribe(baseObserver(engineerInfo -> {
SPUtils.put("USER_IDENTITY", engineerInfo.getIdentity());
dump();
}));
} }
@Override @Override
......
...@@ -33,7 +33,6 @@ import static android.os.Build.VERSION_CODES.M; ...@@ -33,7 +33,6 @@ import static android.os.Build.VERSION_CODES.M;
* Created by luofan * Created by luofan
* on 2018/5/10. * on 2018/5/10.
*/ */
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;
......
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/cl_white" android:background="@color/cl_white"
android:orientation="vertical" android:orientation="vertical">
>
<RelativeLayout <RelativeLayout
style="@style/title" style="@style/title"
......
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