jiangping
2024-12-11 eb49564ab17c6695d8928d5a63a57c58b3cfd79c
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/thrid/WmsServiceImpl.java
@@ -12,11 +12,15 @@
import com.doumee.core.wms.model.response.WmsBaseDataResponse;
import com.doumee.core.wms.model.response.WmsBaseResponse;
import com.doumee.core.wms.model.response.WmsInventoryDataResponse;
import com.doumee.core.wx.wxPlat.WxPlatConstants;
import com.doumee.core.wx.wxPlat.WxPlatNotice;
import com.doumee.dao.business.*;
import com.doumee.dao.business.dao.SmsConfigMapper;
import com.doumee.dao.business.dao.SmsEmailMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.SystemUserMapper;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.impl.SmsEmailServiceImpl;
import com.doumee.service.business.third.EmayService;
import com.doumee.service.business.third.WmsService;
@@ -49,6 +53,8 @@
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
    private SystemUserMapper systemUserMapper;
    @Autowired
    private PlatformJobMapper platformJobMapper;
    @Autowired
    private PlatformWmsDetailMapper platformWmsDetailMapper;
@@ -64,6 +70,8 @@
    private EmayService emayService;
    @Autowired
    private RetentionMapper retentionMapper;
    @Autowired
    private WxNoticeConfigMapper wxNoticeConfigMapper;
    /**
     * 入库通知任务业务处理
     * @param job 参数
@@ -215,9 +223,9 @@
    }
    private static void logResult(WmsBaseResponse<WmsBaseDataResponse> res,String name) {
        if(StringUtils.equals(res.getData().get(0).getSuccess(), WmsBaseResponse.CODE_SUCCESS)){
            log.info("【WMS接口:"+name+"】================成功====\n"+res);
            log.info("【WMS接口:"+name+"】================成功====\n"+ JSONObject.toJSONString(res));
        }else{
            log.error("【WMS接口:"+name+"】================失败====:\n"+ res);
            log.error("【WMS接口:"+name+"】================失败====:\n"+  JSONObject.toJSONString(res));
        }
    }
    /**
@@ -311,14 +319,33 @@
    private void startEndNoticeToDriver(List<PlatformJob> jobList) {
        for(PlatformJob job : jobList){
            //-----TODO-----------任康,发送司机公众号和
            //短信通知
            if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.WAIT_CONFIRM.getKey())){
                SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz,
                        emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,job.getId(),
                        SmsConstants.platformJobContent.platformJobNewJob,null,null
                );
                //查询司机信息 发送公众号通知
                if(Objects.nonNull(job.getDriverId())){
                    //发送公众号通知 给提交人
                    SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda()
                            .eq(SystemUser::getDeleted, Constants.ZERO)
                            .eq(SystemUser::getType, Constants.ZERO)
                            .eq(SystemUser::getMobile,job.getDrivierPhone())
                            .last(" limit 1 "));
                    if(Objects.nonNull(driver) && StringUtils.isNotBlank(driver.getOpenid())){
                        WxPlatNotice wxPlatNotice = new WxPlatNotice();
                        wxPlatNotice.sendWmsTemplateNotice(systemDictDataBiz,
                                wxNoticeConfigMapper,job,
                                WxPlatConstants.platformJobContent.platformJobNewJob,
                                systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                                Arrays.asList(driver.getOpenid().split(","))
                        );
                    }
                }
            }
        }
    }
@@ -546,12 +573,35 @@
                            .set(PlatformJob::getStatus,Constants.PlatformJobStatus.CANCEL.getKey())
                            .in(PlatformJob::getId,setJobIds)
                    );
                    for (Integer jobId:setJobIds
                    ) {
                        //短信通知
                        SmsEmailServiceImpl.sendPlatformJobSms(systemDictDataBiz,
                                emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,jobId,
                                SmsConstants.platformJobContent.platformJobStopJob,null,null
                        );
                        //公众号通知司机 任务取消
                        PlatformJob job = platformJobMapper.selectById(jobId);
                        if(Objects.nonNull(job)){
                            //发送公众号通知 给提交人
                            SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda()
                                    .eq(SystemUser::getDeleted, Constants.ZERO)
                                    .eq(SystemUser::getType, Constants.ZERO)
                                    .eq(SystemUser::getMobile,job.getDrivierPhone())
                                    .last(" limit 1 "));
                            if(Objects.nonNull(driver) && StringUtils.isNotBlank(driver.getOpenid())){
                                WxPlatNotice wxPlatNotice = new WxPlatNotice();
                                wxPlatNotice.sendWmsCancelTemplateNotice(systemDictDataBiz,
                                        wxNoticeConfigMapper,job,
                                        WxPlatConstants.platformJobContent.platformJobCancel,
                                        systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                                        Arrays.asList(driver.getOpenid().split(","))
                                );
                            }
                        }
                    }
                }
            }
@@ -612,6 +662,25 @@
                                emayService,smsEmailMapper,smsConfigMapper,platformJobMapper,jobId,
                                SmsConstants.platformJobContent.platformJobStopJob,null,null
                        );
                        //公众号通知司机 任务取消
                        PlatformJob job = platformJobMapper.selectById(jobId);
                        if(Objects.nonNull(job)){  //发送公众号通知 给提交人
                            SystemUser driver = systemUserMapper.selectOne(new QueryWrapper<SystemUser>().lambda()
                                    .eq(SystemUser::getDeleted, Constants.ZERO)
                                    .eq(SystemUser::getType, Constants.ZERO)
                                    .eq(SystemUser::getMobile,job.getDrivierPhone())
                                    .last(" limit 1 "));
                            if(Objects.nonNull(driver) && StringUtils.isNotBlank(driver.getOpenid())){
                                WxPlatNotice wxPlatNotice = new WxPlatNotice();
                                wxPlatNotice.sendWmsCancelTemplateNotice(systemDictDataBiz,
                                        wxNoticeConfigMapper,job,
                                        WxPlatConstants.platformJobContent.platformJobCancel,
                                        systemDictDataBiz.queryByCode(Constants.WX_PLATFORM,Constants.WX_PLATFORM_ACCESS_TOKEN).getCode(),
                                        Arrays.asList(driver.getOpenid().split(","))
                                );
                            }
                        }
                    }
                }
            }