Просмотр исходного кода

Merge remote-tracking branch 'origin/develop' into develop

FengChaoYu 4 месяцев назад
Родитель
Сommit
510d9952c3

+ 4 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/listvo/workorder/OrderBaseAppraiseVO.java

@@ -89,4 +89,8 @@ public class OrderBaseAppraiseVO {
     @ApiModelProperty(value = "服务单类型")
     private String orderType;
 
+
+    @ZfireField(hide = true, ignoreSelect = true)
+    @ApiModelProperty(value = "第一次申诉单号")
+    private String appraiseApplyId;
 }

+ 2 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminDeptLogic.java

@@ -277,7 +277,8 @@ public class AdminDeptLogic {
             adminDeptWebsit.setWebsitId((String)row.get(0));
             adminDeptWebsit.setWebsitName((String)row.get(1));
 
-
+            adminDeptWebsitService.lambdaUpdate().eq(AdminDeptWebsit::getAdminDeptId,adminDept1.getAdminDeptId())
+                    .eq(AdminDeptWebsit::getWebsitId,adminDeptWebsit.getWebsitId()).remove();
             adminDeptWebsits.add(adminDeptWebsit);
 
         }

+ 39 - 24
mall-server-api/src/main/java/com/gree/mall/manager/logic/policy/AgreementLogic.java

@@ -12,6 +12,7 @@ import com.gree.mall.manager.bean.policy.*;
 import com.gree.mall.manager.commonmapper.PolicyCMapper;
 import com.gree.mall.manager.constant.Constant;
 import com.gree.mall.manager.enums.*;
+import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.*;
 import com.gree.mall.manager.plus.service.*;
@@ -32,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.mail.MessagingException;
+import javax.mail.Session;
 import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
@@ -269,14 +271,18 @@ public class AgreementLogic {
             //发邮件
             try {
                 this.sendEmailFile(mailboxSendRecordPolicies, mailboxSendRecord, mailbox,emailUtilsNew);
-                mailboxSendRecord.setSendStatus("OK");
-                mailboxSendRecord.setSendTime(new Date());
-                mailboxSendRecord.updateById();
+                MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
+                mailboxSendRecord1.setId(mailboxSendRecord.getId());
+                mailboxSendRecord1.setSendStatus("OK");
+                mailboxSendRecord1.setSendTime(new Date());
+                mailboxSendRecord1.updateById();
             } catch (Exception e) {
                 log.error("发送意外保险失败"+e.toString());
-                mailboxSendRecord.setSendStatus("NO");
-                mailboxSendRecord.setSendTime(new Date());
-                mailboxSendRecord.updateById();
+                MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
+                mailboxSendRecord1.setId(mailboxSendRecord.getId());
+                mailboxSendRecord1.setSendStatus("NO");
+                mailboxSendRecord1.setSendTime(new Date());
+                mailboxSendRecord1.updateById();
             }
         }
 
@@ -285,14 +291,18 @@ public class AgreementLogic {
             //发邮件
             try {
                 this.sendEmailFileEm(mailboxSendRecordPolicies, mailboxSendRecord, mailbox,emailUtilsNew);
-                mailboxSendRecord.setSendStatus("OK");
-                mailboxSendRecord.setSendTime(new Date());
-                mailboxSendRecord.updateById();
+                MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
+                mailboxSendRecord1.setId(mailboxSendRecord.getId());
+                mailboxSendRecord1.setSendStatus("OK");
+                mailboxSendRecord1.setSendTime(new Date());
+                mailboxSendRecord1.updateById();
             } catch (Exception e) {
                 log.error("发送雇主保险失败"+e.toString());
-                mailboxSendRecord.setSendStatus("NO");
-                mailboxSendRecord.setSendTime(new Date());
-                mailboxSendRecord.updateById();
+                MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
+                mailboxSendRecord1.setId(mailboxSendRecord.getId());
+                mailboxSendRecord1.setSendStatus("NO");
+                mailboxSendRecord1.setSendTime(new Date());
+                mailboxSendRecord1.updateById();
             }
         }
 
@@ -302,14 +312,18 @@ public class AgreementLogic {
             //发邮件
             try {
                 this.sendEmailFileIn(mailboxSendRecordPolicies, mailboxSendRecord, mailbox,emailUtilsNew);
-                mailboxSendRecord.setSendStatus("OK");
-                mailboxSendRecord.setSendTime(new Date());
-                mailboxSendRecord.updateById();
+                MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
+                mailboxSendRecord1.setId(mailboxSendRecord.getId());
+                mailboxSendRecord1.setSendStatus("OK");
+                mailboxSendRecord1.setSendTime(new Date());
+                mailboxSendRecord1.updateById();
             } catch (Exception e) {
                 log.error("发送工伤保险失败"+e.toString());
-                mailboxSendRecord.setSendStatus("NO");
-                mailboxSendRecord.setSendTime(new Date());
-                mailboxSendRecord.updateById();
+                MailboxSendRecord mailboxSendRecord1 = new MailboxSendRecord();
+                mailboxSendRecord1.setId(mailboxSendRecord.getId());
+                mailboxSendRecord1.setSendStatus("NO");
+                mailboxSendRecord1.setSendTime(new Date());
+                mailboxSendRecord1.updateById();
             }
         }
 
@@ -349,9 +363,10 @@ public class AgreementLogic {
         //发送邮箱
 
         //分发邮件
-
+        Session session = emailUtilsNew.loadMailSession();
         for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
-            emailUtilsNew.send(s, mailbox.getSendMailbox(), "工伤险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
+
+            emailUtilsNew.send(session,s, mailbox.getSendMailbox(), "工伤险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
                     + mailbox.getSendName() + "保险人员名单详情见附件", filePath);
         }
 
@@ -400,9 +415,9 @@ public class AgreementLogic {
 
 
         //分发邮件
-
+        Session session = emailUtilsNew.loadMailSession();
         for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
-            emailUtilsNew.send(s, mailbox.getSendMailbox(), "雇主险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
+            emailUtilsNew.send(session,s, mailbox.getSendMailbox(), "雇主险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
                     + mailbox.getSendName() + "保险人员名单详情见附件", filePath);
         }
 
@@ -453,9 +468,9 @@ public class AgreementLogic {
 
 
         //分发邮件
-
+        Session session = emailUtilsNew.loadMailSession();
         for (String s : mailboxSendRecord.getReceiveMailbox().split(",|,")) {
-            emailUtilsNew.send(s, mailbox.getSendMailbox(), "意外险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
+            emailUtilsNew.send(session,s, mailbox.getSendMailbox(), "意外险-" + mailboxSendRecord.getSendBatch() + "-" + mailbox.getSendName(), "你好,以下是" + DateUtil.format(new Date(), "yyyy-MM-dd")
                     + mailbox.getSendName() + "保险人员名单详情见附件", filePath);
         }
 

+ 12 - 8
mall-server-api/src/main/java/com/gree/mall/manager/logic/policy/PolicyOrderLogic.java

@@ -302,12 +302,13 @@ public class PolicyOrderLogic {
                     policyOrderup.setPolicyOrderStatus("DSX");
                 }
 
-                log.info("打印保险导入1");
-                if (policyOrderService.lambdaQuery().le(PolicyOrder::getStartTime,policyOrderup.getEndTime())
-                .ge(PolicyOrder::getEndTime,policyOrderup.getStartTime())
-                        .eq(PolicyOrder::getType,"IN")
-                        .ne(PolicyOrder::getPolicyOrderStatus,"YSX")
-                        .eq(PolicyOrder::getWebsitUserId,policyOrderup.getWebsitUserId()).count() > 0){
+                Integer count = policyOrderService.lambdaQuery().le(PolicyOrder::getStartTime, policyOrderup.getEndTime())
+                        .ge(PolicyOrder::getEndTime, policyOrderup.getStartTime())
+                        .eq(PolicyOrder::getType, "IN")
+                        .ne(PolicyOrder::getPolicyOrderStatus, "YSX")
+                        .eq(PolicyOrder::getWebsitUserId, policyOrderup.getWebsitUserId()).count();
+                log.error("打印保险导入1+"+count);
+                if (count > 0){
                     throw new RemoteServiceException(errPrefix + "师傅已导入该时间段得保险");
                 }
 
@@ -337,8 +338,7 @@ public class PolicyOrderLogic {
                 else {
                     workerPolicy.setStatus("DSX");
                 }
-                workerPolicy.insert();
-                log.info("打印保险导入2");
+
                 if (workerPolicyService.lambdaQuery().le(WorkerPolicy::getStartTime,policyOrderup.getEndTime())
                         .ge(WorkerPolicy::getEndTime,policyOrderup.getStartTime())
                         .eq(WorkerPolicy::getPolicyType,"IN")
@@ -347,6 +347,10 @@ public class PolicyOrderLogic {
                     throw new RemoteServiceException(errPrefix + "师傅已导入该时间段得保险");
                 }
 
+                workerPolicy.insert();
+
+
+
             }
 
 

+ 41 - 31
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/AppraiseRelaLogic.java

@@ -12,10 +12,7 @@ import com.gree.mall.manager.bean.workorder.PgAppraiseApplyVO;
 import com.gree.mall.manager.bean.workorder.PgAppraiseCategoryVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.enums.ExamineStatusEnum;
-import com.gree.mall.manager.enums.workorder.AppraiseApplyStatusEnum;
-import com.gree.mall.manager.enums.workorder.AppraiseConfigTypeEnum;
-import com.gree.mall.manager.enums.workorder.AppraiseOnusEnum;
-import com.gree.mall.manager.enums.workorder.AppraiseStatusEnum;
+import com.gree.mall.manager.enums.workorder.*;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
 import com.gree.mall.manager.plus.entity.*;
@@ -224,11 +221,16 @@ public class AppraiseRelaLogic {
             throw new RemoteServiceException("填入的“工单编号”不存在");
         }
 
-        if (orderBase.getAppraiseStatus().equals(AppraiseStatusEnum.A.getKey())
-                || orderBase.getAppraiseStatus().equals(AppraiseStatusEnum.D.getKey())) {
-            throw new RemoteServiceException("工单评价为“好评”,不需要申诉");
+        if (!(orderBase.getOrderStatus().equals(OrderBaseStatusEnum.YWG.getKey())
+                || orderBase.getOrderStatus().equals(OrderBaseStatusEnum.YJS.getKey()))) {
+            throw new RemoteServiceException("工单状态非“已完工”,不能提交申诉");
         }
 
+//        if (orderBase.getAppraiseStatus().equals(AppraiseStatusEnum.A.getKey())
+//                || orderBase.getAppraiseStatus().equals(AppraiseStatusEnum.D.getKey())) {
+//            throw new RemoteServiceException("工单评价为“好评”,不需要申诉");
+//        }
+
         final PgAppraiseApply beforeApply = pgAppraiseApplyService.lambdaQuery()
                 .eq(PgAppraiseApply::getIsSecond, false)
                 .eq(PgAppraiseApply::getOrderBaseId, bean.getOrderBaseId())
@@ -298,6 +300,8 @@ public class AppraiseRelaLogic {
             throw new RemoteServiceException("已有中差评申诉“审核通过”记录, 提交失败");
         }
 
+        bean.setAppraiseStatus(orderBase.getAppraiseStatus());
+        bean.setAppraiseSource(orderBase.getAppraiseSource());
         bean.setStatus(AppraiseApplyStatusEnum.WAIT_CENTER.getKey());
         bean.setApplyTime(DateUtil.date());
         bean.setApplyBy(adminUser.getNickName());
@@ -397,7 +401,6 @@ public class AppraiseRelaLogic {
             // 首次申诉:判定网点【无责】的,则申诉成功,审核结果为【好评】,不触发二次可申诉
             // 二次申诉:判定网点【无责】的,则申诉成功,审核结果为【好评】
             apply.setExamineResult(AppraiseStatusEnum.A.getKey());
-
         } else if (apply.getWebsitResult().equals(AppraiseOnusEnum.HALF.getKey())) {
             // 首次申诉:判定网点为【半责】的,审核结果为【剔除】,不触发起二次可申诉
             // 二次申诉:判定网点【半责】的,审核结果为【剔除】
@@ -406,6 +409,10 @@ public class AppraiseRelaLogic {
             // 首次申诉:判定网点【全责】的,审核结果为【驳回】,触发二次可申诉
             // 二次申诉:判定网点【全责】的,审核结果为【驳回】,维护原评价
             apply.setExamineResult(orderBase.getAppraiseStatus());
+            PgAppraiseApply copy = new PgAppraiseApply();
+            this.copyApply(copy, apply);
+            copy.setIsSecond(true);
+            copy.insert();
         }
 
         apply.updateById();
@@ -453,29 +460,7 @@ public class AppraiseRelaLogic {
         List<PgAppraiseApply> newList = new ArrayList<>();
         for (PgAppraiseApply apply : copyList) {
             PgAppraiseApply copy = new PgAppraiseApply();
-            copy.setOrderBaseId(apply.getOrderBaseId())
-                    .setOrderType(apply.getOrderType())
-                    .setOrderSmallType(apply.getOrderSmallType())
-                    .setOrderSmallTypeText(apply.getOrderSmallTypeText())
-                    .setCompanyWechatId(apply.getCompanyWechatId())
-                    .setCompanyWechatName(apply.getCompanyWechatName())
-                    .setStatus(AppraiseApplyStatusEnum.WAIT.getKey())
-                    .setWorkerId(apply.getWorkerId())
-                    .setWorkerNumber(apply.getWorkerNumber())
-                    .setWorkerName(apply.getWorkerName())
-                    .setWorkerMobile(apply.getWorkerMobile())
-                    .setWorkerIdcard(apply.getWorkerIdcard())
-                    .setWebsitId(apply.getWebsitId())
-                    .setWebsitName(apply.getWebsitName())
-                    .setOverTime(apply.getOverTime())
-                    .setAppraiseStatus(apply.getAppraiseStatus())
-                    .setAppraiseContent(apply.getAppraiseContent())
-                    .setAppraiseSource(apply.getAppraiseSource())
-                    .setReason(apply.getReason())
-                    .setUserName(apply.getUserName())
-                    .setUserMobile(apply.getUserMobile())
-                    .setAddress(apply.getAddress());
-
+            this.copyApply(copy, apply);
 
             newList.add(copy);
         }
@@ -490,6 +475,31 @@ public class AppraiseRelaLogic {
                 .update();
     }
 
+    private void copyApply(PgAppraiseApply copy, PgAppraiseApply apply) {
+        copy.setOrderBaseId(apply.getOrderBaseId())
+                .setOrderType(apply.getOrderType())
+                .setOrderSmallType(apply.getOrderSmallType())
+                .setOrderSmallTypeText(apply.getOrderSmallTypeText())
+                .setCompanyWechatId(apply.getCompanyWechatId())
+                .setCompanyWechatName(apply.getCompanyWechatName())
+                .setStatus(AppraiseApplyStatusEnum.WAIT.getKey())
+                .setWorkerId(apply.getWorkerId())
+                .setWorkerNumber(apply.getWorkerNumber())
+                .setWorkerName(apply.getWorkerName())
+                .setWorkerMobile(apply.getWorkerMobile())
+                .setWorkerIdcard(apply.getWorkerIdcard())
+                .setWebsitId(apply.getWebsitId())
+                .setWebsitName(apply.getWebsitName())
+                .setOverTime(apply.getOverTime())
+                .setAppraiseStatus(apply.getAppraiseStatus())
+                .setAppraiseContent(apply.getAppraiseContent())
+                .setAppraiseSource(apply.getAppraiseSource())
+                .setReason(apply.getReason())
+                .setUserName(apply.getUserName())
+                .setUserMobile(apply.getUserMobile())
+                .setAddress(apply.getAddress());
+    }
+
     public void batchUpdateEnd(List<String> ids) {
         if (CollectionUtil.isEmpty(ids)) {
             throw new RemoteServiceException("请选择记录");

+ 16 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseLogic.java

@@ -98,6 +98,7 @@ public class OrderBaseLogic {
     private final RegionService regionService;
     private final NoticeRecordService noticeRecordService;
     private final LeaseOrderService leaseOrderService;
+    private final PgAppraiseApplyService pgAppraiseApplyService;
     private final ElasticsearchRestTemplate elasticsearchRestTemplate;
 
     /**
@@ -206,6 +207,21 @@ public class OrderBaseLogic {
         FieldUtils.supplyParam(zfireParamBean, OrderBaseAppraiseVO.class, commonLogic.getAdminUser());
 //        zfireParamBean.setAdminWebsitIds(zfireParamBean.getAdminWebsitIds());
         IPage<OrderBaseAppraiseVO> page = commonMapper.orderBaseAppraiseList(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+        if (CollectionUtil.isNotEmpty(page.getRecords())) {
+            final List<PgAppraiseApply> applyList = pgAppraiseApplyService.lambdaQuery()
+                    .in(PgAppraiseApply::getOrderBaseId, page.getRecords().stream().map(OrderBaseAppraiseVO::getId).collect(Collectors.toList()))
+                    .groupBy(PgAppraiseApply::getOrderBaseId)
+                    .list();
+            // 查询申诉记录
+            if (CollectionUtil.isNotEmpty(applyList)) {
+                final Map<String, String> applyMap = applyList.stream().collect(Collectors.toMap(PgAppraiseApply::getOrderBaseId, PgAppraiseApply::getId));
+                for (OrderBaseAppraiseVO record : page.getRecords()) {
+                    if (applyMap.containsKey(record.getId())) {
+                        record.setAppraiseApplyId(applyMap.get(record.getId()));
+                    }
+                }
+            }
+        }
         return page;
     }
 

+ 5 - 5
mall-server-api/src/main/java/com/gree/mall/manager/utils/email/EmailUtilsNew.java

@@ -84,8 +84,8 @@ public class EmailUtilsNew {
      * @param content  邮件内容 可以是html内容
      * @param attachPath 附件路径
      */
-    public void send(String toEmail,String emailReceAccount, String subject, String content, String attachPath) {
-        Session session = loadMailSession();
+    public void send(Session session,String toEmail,String emailReceAccount, String subject, String content, String attachPath) {
+       // Session session = loadMailSession();
 
         MimeMessage mm = new MimeMessage(session);
         try {
@@ -119,9 +119,9 @@ public class EmailUtilsNew {
             mm.setContent(multipart);
             Transport.send(mm);
         } catch (Exception e) {
-            String err = e.getMessage();
+
             // 在这里处理message内容, 格式是固定的
-            System.out.println(err);
+            System.out.println(e.toString());
         }
 
     }
@@ -217,7 +217,7 @@ public class EmailUtilsNew {
 
 
 
-    private Session loadMailSession() {
+    public Session loadMailSession() {
         try {
             // 配置发送邮件的环境属性
             final Properties props = new Properties();

+ 1 - 0
mall-server-api/src/main/java/com/gree/mall/manager/utils/excel/ExcelUtils.java

@@ -202,6 +202,7 @@ public class ExcelUtils {
             build.write(excelData.getRows(),writeSheet).finish();
             // 关闭流
             out.flush();
+            out.close();
         } catch (FileNotFoundException e) {
             throw new RuntimeException(e);
         } catch (IOException e) {

+ 6 - 0
mall-server-api/src/main/resources/mapper/WebsitSalesCMapper.xml

@@ -192,6 +192,12 @@
         <if test="overTime != null and overTime !=''">
             AND a.create_time between  #{overTime} and #{overEndTime}
         </if>
+        <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
+            AND d.websit_id IN
+            <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
           b.worker_number,a.order_small_type,b.websit_id
     </select>