zq-erp/src/main/java/com/matrix/system/activity/dao/ActivitySignWriteoffDao.java
@@ -25,4 +25,6 @@ ZjrVo selectUsernameByUserId(@Param("userId")Long userId, @Param("receiveId")Long receiveId); ShopDeliveryInfo selectShopDeliveryInfoByLogisticsId(@Param("logisticsId")Integer logisticsId); ActivitySignWriteoff selectActivitySignWriteoffByUserIDAndReceiveId(@Param("logisticsId")Long id, @Param("logisticsId")long receiveId); } zq-erp/src/main/java/com/matrix/system/activity/service/ActivitySignWriteoffService.java
@@ -27,6 +27,7 @@ import com.matrix.system.common.dao.SystemDictionaryDao; import com.matrix.system.hive.action.util.QueryUtil; import com.matrix.system.hive.dao.SysVipInfoDao; import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; import com.matrix.system.shopXcx.bean.ShopActivities; import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; @@ -65,6 +66,8 @@ ShopDeliveryInfoDao shopDeliveryInfoDao; @Autowired ShopLogisticsInfoDao shopLogisticsInfoDao; @Autowired private WxShopLogisticsQueryService wxShopLogisticsQueryService; public IPage<SignWriteoffListVo> findSignWriteoffList(Page<SignWriteoffListVo> page, SignWriteoffListDto signWriteoffListDto) { @@ -108,8 +111,11 @@ //物流跟踪 Integer logisticsId = activitySignWriteoffLogistics.getLogisticsId(); if(ObjectUtil.isNotEmpty(logisticsId)) { List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(logisticsId); ShopDeliveryInfo shopDeliveryInfo = shopDeliveryInfoDao.selectById(logisticsId); if(ObjectUtil.isNotEmpty(shopDeliveryInfo)){ //查看物流信息 wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo); List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); if(CollUtil.isNotEmpty(shopLogisticsInfos)) { ArrayList<LogisticsVo> logisticsVos = new ArrayList<>(); for(ShopLogisticsInfo shopLogistics : shopLogisticsInfos) { @@ -121,7 +127,6 @@ signWriteoffVo.setActivities(logisticsVos); } } } } result.putInMap("signWriteoffVo", signWriteoffVo); @@ -194,81 +199,6 @@ shopDeliveryInfo.setDeliveryTime(new Date()); shopDeliveryInfoDao.insert(shopDeliveryInfo); // Integer id = shopDeliveryInfo.getId(); // if(ObjectUtil.isNotEmpty(id)) { // List<ShopLogisticsInfo> shopLogisticsList = new ArrayList<ShopLogisticsInfo>(); // AjaxResult result = new AjaxResult(); // Map<String, String> logisticsInfo = new HashMap<String, String>(); // try { // if (shopDeliveryInfo == null) { // return new AjaxResult(AjaxResult.STATUS_FAIL, "找不到发货信息"); // } // if (!StringUtils.isNotBlank(shopDeliveryInfo.getWaybillNo()) || !StringUtils.isNotBlank(shopDeliveryInfo.getLogisticsCompanyCode())) { // return new AjaxResult(AjaxResult.STATUS_FAIL, "物流公司信息为空"); // } // logisticsInfo.put("logisticsCompany", shopDeliveryInfo.getLogisticsCompany()); // logisticsInfo.put("waybillNo", shopDeliveryInfo.getWaybillNo()); // // //如果已经签收直接查数据库 // if (AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR.equals(shopDeliveryInfo.getLogisticsStatus())) { // // List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); // logisticsInfo.put("logisticsStatus", String.valueOf(AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR)); // result.setStatus(AjaxResult.STATUS_SUCCESS); // result.setRows(shopLogisticsInfos); // result.putInMap("logisticsInfo", logisticsInfo); // return result; // } // Map<String, String> param = new HashMap<String, String>(); // param.put("ShipperCode", shopDeliveryInfo.getLogisticsCompanyCode()); // param.put("LogisticCode", shopDeliveryInfo.getWaybillNo()); // Map<String, String> paramsUrl = getparams(param); // LogUtil.info("物流查询参数" + paramsUrl); // String logisticsResult = HttpCurlUtil.sendPost(logisticsUrl, paramsUrl); // LogUtil.info("查询物流返回信息" + logisticsResult); // LogisticsInfoVo logisticsInfoVo = JSON.parseObject(logisticsResult, LogisticsInfoVo.class); // if (logisticsInfoVo.isSuccess()) { // ShopDeliveryInfo shopDelivery = new ShopDeliveryInfo(); // shopDelivery.setLogisticsStatus(Integer.valueOf(logisticsInfoVo.getState())); // shopDelivery.setId(shopDeliveryInfo.getId()); // logisticsInfo.put("logisticsStatus", logisticsInfoVo.getState()); // //更新物流状态 // shopDeliveryInfoDao.updateByModel(shopDelivery); // if (CollectionUtils.isNotEmpty(logisticsInfoVo.getTraces())) { // List<Map<String, String>> mapTraces = logisticsInfoVo.getTraces(); // for (int i = 0; i < mapTraces.size(); i++) { // ShopLogisticsInfo shopLogisticsInfo = new ShopLogisticsInfo(); // shopLogisticsInfo.setCreateBy(AppConstance.SYSTEM_USER); // shopLogisticsInfo.setUpdateBy(AppConstance.SYSTEM_USER); // shopLogisticsInfo.setLogisticsTime(mapTraces.get(i).get("AcceptTime")); // String acceptStation = mapTraces.get(i).get("AcceptStation"); // shopLogisticsInfo.setDescribe(acceptStation); // shopLogisticsInfo.setDelieryId(shopDeliveryInfo.getId()); // if (acceptStation.indexOf(AppConstance.KDN_IS_SIGN) != -1) { // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR); // } else if (acceptStation.indexOf(AppConstance.KDN_IS_RECEIVE) != -1) { // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_RECEIVE); // } else if (acceptStation.indexOf(AppConstance.KDN_IS_ON_WAY) != -1) { // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_ON_WAY); // } else if (acceptStation.indexOf(AppConstance.KDN_IS_MISTAKE) != -1) { // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_MISTAKE); // } else { // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_NONE); // } // shopLogisticsList.add(shopLogisticsInfo); // } // shopLogisticsInfoDao.deleteByDelieryId(shopDeliveryInfo.getId()); // if (CollectionUtils.isNotEmpty(shopLogisticsList)) { // shopLogisticsInfoDao.batchInsert(shopLogisticsList); // } // } // } else { // throw new GlobleException(logisticsInfoVo.getReason()); // } // // } catch (Exception e) { // throw new GlobleException("物流信息查询失败"); // } //更新核销记录 activitySignWriteoff.setState(ActivitySignWriteoff.STATE_THREE); activitySignWriteoff.setWriteoffTime(new Date()); @@ -283,7 +213,6 @@ activitySignReceiveRecord.setConsigneeAddress(logisticsSubmitDto.getShdz()); activitySignReceiveRecord.setConsigneePhone(logisticsSubmitDto.getLxdh()); activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); // } return new AjaxResult(AjaxResult.STATUS_SUCCESS, "发货成功"); } zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSignAction.java
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.matrix.component.redis.RedisUserLoginUtils; import com.matrix.core.exception.GlobleException; import com.matrix.core.pojo.AjaxResult; import com.matrix.core.tools.StringUtils; import com.matrix.system.activity.dao.ActivitySignAwardSetDao; @@ -22,9 +23,14 @@ import com.matrix.system.hive.bean.SysVipInfo; import com.matrix.system.shopXcx.api.dto.SeeAwardTextDto; import com.matrix.system.shopXcx.api.dto.SignAwardDto; import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; import com.matrix.system.shopXcx.api.vo.*; import com.matrix.system.shopXcx.bean.ShopActivities; import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; import com.matrix.system.shopXcx.dao.ShopActivitiesDao; import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; import com.matrix.system.shopXcx.dao.ShopLogisticsInfoDao; import com.matrix.system.shopXcx.vo.SalesOrderVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -63,6 +69,15 @@ @Autowired private ActivitySignRecordDao activitySignRecordDao; @Autowired ShopDeliveryInfoDao shopDeliveryInfoDao; @Autowired private ShopLogisticsInfoDao shopLogisticsInfoDao; @Autowired private WxShopLogisticsQueryService wxShopLogisticsQueryService; @ApiOperation(value = "获取签到基本信息", notes = "") @ApiResponses({ @@ -140,6 +155,56 @@ ajaxResult.setData(signBasicInfoVo); return ajaxResult; } /** * 查看历史签到记录 * * @param * @return */ @ApiOperation(value = "查看历史签到记录", notes = "") @GetMapping(value = "getSignRecord/{actId}/{month}") @ResponseBody public AjaxResult getSignRecord(@PathVariable("actId") long actId,@PathVariable("month") String dateStr) { //获取登录人信息 SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); Long companyId = loginUser.getCompanyId(); Long userId = loginUser.getId(); Date date = DateUtil.parse(dateStr); /** * 默认获取当前月份 * 获取当前月份的天数 */ List<ActivitySignRecordVo> activitySignRecordVos = new ArrayList<>(); //获取当前月的第一天是星期几 DateTime dateTime = DateUtil.beginOfMonth(date); int i = DateUtil.dayOfWeek(dateTime); for(int j = 1;j<i;j++){ ActivitySignRecordVo activitySignRecordVoNull = new ActivitySignRecordVo(); activitySignRecordVos.add(activitySignRecordVoNull); } List<String> monthFullDays = getMonthFullDay(DateUtil.year(DateUtil.date()), DateUtil.month(DateUtil.date()) + 1); for(String monthFullDay : monthFullDays){ ActivitySignRecordVo activitySignRecordVo = new ActivitySignRecordVo(); activitySignRecordVo.setSignTime(monthFullDay); activitySignRecordVo.setActivityId(actId); activitySignRecordVo.setCompanyId(companyId); //对应日期是否已签到 Date dateSign = DateUtil.parse(monthFullDay); ActivitySignRecord activitySignRecordDone = activitySignRecordDao.selectOneByActIdAndUserIdLikesignTime(actId,userId,dateSign); if(ObjectUtil.isNotEmpty(activitySignRecordDone)){ activitySignRecordVo.setState(1); }else{ activitySignRecordVo.setState(2); } activitySignRecordVos.add(activitySignRecordVo); } AjaxResult ajaxResult = new AjaxResult(); ajaxResult = AjaxResult.buildSuccessInstance(""); ajaxResult.setData(activitySignRecordVos); return ajaxResult; } /** * java 获取 获取某年某月 所有日期(yyyy-mm-dd格式字符串) * @param year @@ -445,7 +510,7 @@ * * @return */ @ApiOperation(value = "物流配送确认", notes = "") @ApiOperation(value = "物流配送信息查看", notes = "") @PostMapping(value = "/logisticsInsure") @ApiResponses({ @ApiResponse(code = 200, message = "ok", response = SeeAwardTextVo.class) @@ -455,10 +520,41 @@ seeAwardTextDto.setUserId(loginUser.getId()); seeAwardTextDto.setCompanyId(loginUser.getCompanyId()); SeeAwardTextVo seeAwardTextVO = activitySignReceiveRecordDao.selectSeeAwardTextVOById(seeAwardTextDto); long receiveId = seeAwardTextVO.getId(); //获取核销记录的ID ActivitySignWriteoff activitySignWriteoff = activitySignWriteoffDao.selectActivitySignWriteoffByUserIDAndReceiveId(loginUser.getId(),receiveId); Integer logisticsId = activitySignWriteoff.getLogisticsId(); ShopDeliveryInfo shopDeliveryInfo = shopDeliveryInfoDao.selectById(logisticsId); if(ObjectUtil.isNotEmpty(shopDeliveryInfo)){ //查看物流信息 wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo); List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); seeAwardTextVO.setShopLogisticsInfos(shopLogisticsInfos); } AjaxResult result=AjaxResult.buildSuccessInstance(seeAwardTextVO); return result; } /** * 物流配送确认收货 * * @param * @return */ @ApiOperation(value = "物流配送确认收货", notes = "") @GetMapping(value = "logisticsInsureById/{awardId}") @ResponseBody public AjaxResult logisticsInsureById(@PathVariable("awardId") long awardId) { ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(awardId); //如果不是待收货状态 if (ActivitySignReceiveRecord.STATE_FOUR != activitySignReceiveRecord.getState()) { throw new GlobleException("该奖品不是待收货状态!"); } activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE); activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); return new AjaxResult(AjaxResult.STATUS_SUCCESS, "收货成功!"); } zq-erp/src/main/java/com/matrix/system/shopXcx/api/vo/SeeAwardTextVo.java
@@ -1,15 +1,20 @@ package com.matrix.system.shopXcx.api.vo; import com.fasterxml.jackson.annotation.JsonFormat; import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; import java.util.List; @Data @ApiModel(value = "SeeAwardTextVo", description = "劵码信息") public class SeeAwardTextVo { @ApiModelProperty(value ="中奖记录ID") private long id; @ApiModelProperty(value ="奖项名称") private String awardName; @@ -46,4 +51,7 @@ @ApiModelProperty(value =" 是否已领取(1:待领取2:已领取)") private Integer state; @ApiModelProperty(value ="物流信息记录") private List<ShopLogisticsInfo> shopLogisticsInfos; } zq-erp/src/main/resources/mybatis/mapper/activity/ActivitySignWriteoffDao.xml
@@ -101,4 +101,12 @@ where a.id = #{logisticsId} </select> <select id="selectActivitySignWriteoffByUserIDAndReceiveId" resultType="com.matrix.system.activity.entity.ActivitySignWriteoff"> SELECT * FROM shop_delivery_info a where a.id = #{logisticsId} </select> </mapper>