diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java index e5fd0528f..91d6100dd 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/app/WxAppinfoController.java @@ -57,9 +57,11 @@ public class WxAppinfoController extends BaseController { String param = merchant.getWeappScene(); ResultData resultData = qrCodeService.exportQrcode(null, null, merchant.getTenantId(), 1, pageUrl, param, 0, "", "", "店铺详情", true); Map map = (Map) resultData.data; - String url = map.get("url"); - merchant.setQrCode(url); - wxMerchantMapper.updateByPrimaryKeySelective(merchant); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + merchant.setQrCode(url); + wxMerchantMapper.updateByPrimaryKeySelective(merchant); + } } }); } @@ -81,9 +83,11 @@ public class WxAppinfoController extends BaseController { String param = couponChannel.getWeappScene(); ResultData resultData = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); Map map = (Map)resultData.data; - String url = map.get("url"); - couponChannel.setQrCode(url); - wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + couponChannel.setQrCode(url); + wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + } } }); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxBrandController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxBrandController.java index 470369fda..71b6a295d 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxBrandController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxBrandController.java @@ -43,7 +43,7 @@ public class WxBrandController extends BaseController { @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) @SystemControllerLog(description = "品牌-列表") - public ResultData list(@ModelAttribute WxBrand wxBrand, Integer pageNum, Integer pageSize) { + public ResultData list(@ModelAttribute WxBrand wxBrand,Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxBrandController::list"); if (null == wxBrand) { wxBrand = new WxBrand(); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index 2a8ca6014..9cfd63f38 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -108,9 +108,11 @@ public class WxMerchantController extends BaseController { String param = "t:md:"+resultData.data; ResultData resultQrCode = qrCodeService.exportQrcode(null,null,wxMerchant.getTenantId(),1,pageUrl,param,0,"","","店铺详情",true); Map map = (Map)resultQrCode.data; - String url = map.get("url"); - wxMerchant.setQrCode(url); - wxMerchantService.updateMerchant(wxMerchant); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + wxMerchant.setQrCode(url); + wxMerchantService.updateMerchant(wxMerchant); + } } return resultData; diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java index dd467a131..85f9a793c 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java @@ -9,13 +9,20 @@ import com.iformall.controller.app.WxAppinfoController; import com.iformall.controller.base.BaseController; import com.iformall.domain.dto.WxCouponChannelDto; import com.iformall.domain.po.MallUserInfo; +import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; +import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.WxCouponChannelAddVo; import com.iformall.domain.vo.WxCouponChannelVo; +import com.iformall.enums.EnumCouponChannelStatus; +import com.iformall.enums.EnumFlowRecordStatus; +import com.iformall.enums.EnumRentContractAppStatus; +import com.iformall.enums.EnumRentContractStatus; import com.iformall.mapper.WxCouponChannelMapper; import com.iformall.service.QrCodeService; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; +import com.iformall.service.WxFlowService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -45,6 +52,10 @@ public class WxCouponChannelController extends BaseController { private WxCouponChannelMapper wxCouponChannelMapper; @Autowired private QrCodeService qrCodeService; + @Autowired + private WxFlowService wxFlowService; + @Autowired + private WxCouponService wxCouponService; @ApiOperation("分页列表接口") @GetMapping("list") @@ -80,9 +91,11 @@ public class WxCouponChannelController extends BaseController { String param = couponChannel.getWeappScene(); ResultData resultDataQ = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); Map map = (Map)resultDataQ.data; - String url = map.get("url"); - couponChannel.setQrCode(url); - wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + couponChannel.setQrCode(url); + wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + } } return resultData; } @@ -103,30 +116,28 @@ public class WxCouponChannelController extends BaseController { logger.debug("[" + getIpAddr() + "] WxCouponChannelController::addbatch"); String[] ids = wxCouponChannelDto.getCouponIds().split(","); String[] channelId = wxCouponChannelDto.getChannelId().split(","); - ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); - List list = (List)resultData.data; - - //生成二维码 - if(CollectionUtils.isNotEmpty(list)){ - String pageUrl = "pages/index/index"; - - for (WxCouponChannelAddVo vo:list) { - WxCouponChannel couponChannel = new WxCouponChannel(); - couponChannel.setId(vo.getId()); - couponChannel.setType(vo.getType()); - String param = couponChannel.getWeappScene(); - ResultData resultDataQ = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); - Map map = (Map)resultDataQ.data; - String url = map.get("url"); - couponChannel.setQrCode(url); - wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + if (org.springframework.util.CollectionUtils.isEmpty(wxCouponChannelDto.getFlowParams())) { + ResultData resultData = wxCouponChannelService.addBatch(ids, channelId, getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); + return resultData; + }else{ + //走审批 + wxCouponChannelDto.getFlowParams().put("ids",wxCouponChannelDto.getCouponIds()); + wxCouponChannelDto.getFlowParams().put("channelId",wxCouponChannelDto.getChannelId()); + wxCouponChannelDto.getFlowParams().put("tenantId",getTenantId()); + wxCouponChannelDto.getFlowParams().put("beginTime",wxCouponChannelDto.getBeginTime()); + wxCouponChannelDto.getFlowParams().put("endTime",wxCouponChannelDto.getEndTime()); + + wxFlowService.start(wxCouponChannelDto.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + //修改coupon applyStatus状态为审核中 + for (String id:ids) { + WxCoupon wxCoupon = new WxCoupon(); + wxCoupon.setId(Long.parseLong(id)); + wxCoupon.setPutApplyStatus(EnumRentContractAppStatus.APPLYING.getCode()); + wxCouponService.update(wxCoupon); } - - resultData.data = null; } - - return resultData; + return new ResultData(); } @ApiOperation("根据id查询接口") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 71a68358b..88dda0528 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -9,12 +9,10 @@ import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.vo.WxCouponStatisVo; -import com.iformall.enums.EnumCouponChannelStatus; -import com.iformall.enums.EnumCouponType; -import com.iformall.enums.EnumCouponValidType; -import com.iformall.enums.EnumDelFlag; +import com.iformall.enums.*; import com.iformall.mapper.WxCouponChannelMapper; import com.iformall.service.WxCouponService; +import com.iformall.service.WxFlowService; import com.iformall.utils.DateUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -38,6 +36,8 @@ public class WxCouponController extends BaseController { private WxCouponService wxCouponService; @Autowired private WxCouponChannelMapper wxCouponChannelMapper; + @Autowired + private WxFlowService wxFlowService; @ApiOperation("分页列表接口") @GetMapping("list") @@ -74,7 +74,6 @@ public class WxCouponController extends BaseController { return wxCouponService.list(wxCoupon, pageNum, pageSize); //全列表 } - @ApiOperation("新增接口") @PostMapping("add") @SystemControllerLog(description = "券投放-新增") @@ -100,8 +99,15 @@ public class WxCouponController extends BaseController { return new ResultData(ResultData.ERROR, "有活动正在上架,请先下架。"); } } - wxCoupon.setTenantId(getTenantId()); + + //作废走审批 + if (EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())) { + if (wxCoupon.getFlowParams() != null && wxCoupon.getFlowParams().size() > 0) { + wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + return new ResultData(); + } + } return wxCouponService.saveOrUpdate(wxCoupon); } @@ -147,7 +153,21 @@ public class WxCouponController extends BaseController { return new ResultData(ErrorCode.COUPON_STOCK_DATE_NO_CAR); } wxCoupon.setTenantId(getTenantId()); - return wxCouponService.updateCouponStockAndEndTime(wxCoupon); + + if(wxCoupon.getFlowParams() != null && wxCoupon.getFlowParams().size() >0){ +// wxCoupon.getFlowParams().put("inventory",wxCoupon.getInventory()); +// wxCoupon.getFlowParams().put("remainInventory",wxCoupon.getRemainInventory()); +// wxCoupon.getFlowParams().put("type",wxCoupon.getType()); +// wxCoupon.getFlowParams().put("validEndDate",wxCoupon.getValidEndDate()); +// wxCoupon.getFlowParams().put("validStartDate",wxCoupon.getValidStartDate()); +// wxCoupon.getFlowParams().put("validType",wxCoupon.getValidType()); + + wxFlowService.start(wxCoupon.getFlowParams(), getUserId(), getUser().getName(), getTenantId()); + }else{ + return wxCouponService.updateCouponStockAndEndTime(wxCoupon); + } + + return new ResultData(); } @ApiOperation("根据id删除接口") @@ -254,7 +274,12 @@ public class WxCouponController extends BaseController { wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); } wxCoupon.setTenantId(getTenantId()); - return new ResultData(wxCouponService.findPressData(wxCoupon,pageNum,pageSize)); + PageInfo pages = wxCouponService.findPressData(wxCoupon,pageNum,pageSize); + List ids = new ArrayList<>(); + for(WxCouponStatisVo vo: pages.getList()) { + ids.add(vo.getId()); + } + return new ResultData(pages); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponOrderController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponOrderController.java index f51053363..56e6a0b9b 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponOrderController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponOrderController.java @@ -6,7 +6,6 @@ import com.iformall.common.ErrorCode; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxAppinfo; -import com.iformall.domain.po.WxCouponOrder; import com.iformall.domain.vo.WxCouponOrderBVo; import com.iformall.enums.EnumAppType; import com.iformall.enums.EnumPayType; @@ -26,7 +25,6 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.text.SimpleDateFormat; import java.util.Map; @RestController @@ -74,47 +72,6 @@ public class WxCouponOrderController extends BaseController { return wxCouponOrderService.detailAdminVo(couponOrderId); } - @RequestMapping("/exportData") - @SystemControllerLog(description = "券包-导出") - public void exportData( - @RequestParam("endDate") String endDate, - @RequestParam("startDate") String startDate, - @RequestParam("merchantName") String merchantName, - @RequestParam("couponOrderStatus") String couponOrderStatus, - @RequestParam("id") String id, - HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] WxCouponOrderController::exportData"); - - WxCouponOrderBVo wxCouponOrder = new WxCouponOrderBVo(); - wxCouponOrder.setTenantId(getTenantId()); - wxCouponOrder.setMerchantName(merchantName); - try { - wxCouponOrder.setId(Long.valueOf(id)); - }catch (Exception e){ - wxCouponOrder.setId(null); - } - try { - wxCouponOrder.setCouponOrderStatus(Integer.valueOf(couponOrderStatus)); - }catch (Exception e){ - wxCouponOrder.setCouponOrderStatus(null); - } - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - try { - wxCouponOrder.setStartTime( sdf.parse(startDate)); - } catch (Exception e) { - wxCouponOrder.setStartTime(null); - } - try { - wxCouponOrder.setEndTime( sdf.parse(endDate)); - } catch (Exception e) { - wxCouponOrder.setEndTime(null); - } - wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); - wxCouponOrderService.exportData(request, response, wxCouponOrder); - - } - @ApiOperation(value = "退券退款", notes = "{\"couponOrderId\":\"string\"}") @PostMapping("/refund") @SystemControllerLog(description = "券包-退券退款") @@ -158,4 +115,17 @@ public class WxCouponOrderController extends BaseController { return new ResultData(ErrorCode.REFUND_ORDER_ERROR.getCode(), "AppInfo获取失败"); } + @GetMapping("exportData") + @SystemControllerLog(description = "券订单数据-导出数据") + public void exportData(@ModelAttribute WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) { + logger.debug("[" + getIpAddr() + "] WxCouponOrderController::exportData"); + if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo(); + wxCouponOrder.setTenantId(getTenantId()); + if (wxCouponOrder.getMerchantName() != null && + wxCouponOrder.getMerchantName().isEmpty()) { + wxCouponOrder.setMerchantName(null); + } + wxCouponOrderService.exportData(wxCouponOrder, request, response); + } + } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgRecordController.java b/mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgRecordController.java index ae3604eca..6b88ea702 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgRecordController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgRecordController.java @@ -27,8 +27,6 @@ public class WxMsgRecordController extends BaseController { @Autowired private MqBaseProducer mqBaseProducer; @Autowired - private WxMsgMapper wxMsgMapper; - @Autowired private SendCallBackSmsServiceImpl msgSendService; @@ -64,9 +62,11 @@ public class WxMsgRecordController extends BaseController { */ @GetMapping(value = "/resendMsg") public ResultData resendMsg(String x, Integer msgType) { + logger.debug("[" + getIpAddr() + "] WxMsgRecordController::resendMsg"); if("xll1dxx1314".equals(x)){ WxMsgRecord msgRecord = new WxMsgRecord(); msgRecord.setMsgType(msgType); + msgRecord.setTenantId(getTenantId()); msgRecord.setMsgStatus(EnumMsgRecordStatus.CONSUME_FAIL.getCode()); List recordList = wxMsgRecordService.findList(msgRecord); for (WxMsgRecord wxMsgRecord:recordList) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java b/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java index e01d23700..bc033b620 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java @@ -1,5 +1,6 @@ package com.iformall.controller.sys; +import com.github.pagehelper.PageInfo; import com.iformall.annotation.SystemControllerLog; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; @@ -13,8 +14,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; - +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController @RequestMapping("wxBusiness") @@ -46,4 +49,67 @@ public class WxBusinessController extends BaseController { return new ResultData(busList); } + @ApiOperation("业态分析接口") + @GetMapping("businessDataList") + @SystemControllerLog(description = "业态分析接口") + public ResultData businessDataList(@ModelAttribute WxBusiness wxBusiness) { + logger.debug("[" + getIpAddr() + "] WxBusinessController::businessDataList"); + List> result = new ArrayList<>(); + Map map = new HashMap<>(); + map.put("title","餐饮");//业态 + map.put("volume","2323.23");//营业额 + map.put("sale","32323.23");//销售坪效 + map.put("rent","32323.23");//租赁坪效 + map.put("rentSaleRate","0.23");//租售比 + map.put("comPrice","香奈儿");//客单价 + map.put("maxCom","32323.23");//贡献率最高商户 + result.add(map); + map = new HashMap<>(); + map.put("title","娱乐");//业态 + map.put("volume","2323.23");//营业额 + map.put("sale","32323.23");//销售坪效 + map.put("rent","32323.23");//租赁坪效 + map.put("rentSaleRate","0.23");//租售比 + map.put("comPrice","香奈儿");//客单价 + map.put("maxCom","32323.23");//贡献率最高商户 + result.add(map); + map = new HashMap<>(); + map.put("title","影视");//业态 + map.put("volume","2323.23");//营业额 + map.put("sale","32323.23");//销售坪效 + map.put("rent","32323.23");//租赁坪效 + map.put("rentSaleRate","0.23");//租售比 + map.put("comPrice","香奈儿");//客单价 + map.put("maxCom","32323.23");//贡献率最高商户 + result.add(map); + return new ResultData(result); + } + + @ApiOperation("贡献率排行") + @GetMapping("devoteList") + @SystemControllerLog(description = "业态分析接口") + public ResultData devoteList(@ModelAttribute WxBusiness wxBusiness,Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxBusinessController::devoteList"); + List> result = new ArrayList<>(); + Map map = new HashMap<>(); + map.put("merchantName","西贝筱面"); + map.put("sale","2323.23");//营业额 + map.put("sale","32323.23");//商户销售坪效 + map.put("devoteRate","1.23");//贡献率 + result.add(map); + map = new HashMap<>(); + map.put("merchantName","肯德基"); + map.put("sale","2323.23");//营业额 + map.put("sale","32323.23");//商户销售坪效 + map.put("devoteRate","1.23");//贡献率 + result.add(map); + PageInfo> page = new PageInfo<>(); + page.setList(result); + page.setTotal(2); + page.setPageNum(1); + page.setPageSize(20); + return new ResultData(page); + } + + } diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index 40fcdb811..b42940e74 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -21,7 +21,7 @@ spring: testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 - connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" + connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000" #jackson: #date-format: yyyy-MM-dd HH:mm:ss # REDIS diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml index e1838b8ee..83bd12514 100644 --- a/mallinkAdmin/src/main/resources/application-prod.yml +++ b/mallinkAdmin/src/main/resources/application-prod.yml @@ -21,7 +21,7 @@ spring: testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 - connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" + connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000" # REDIS redis: host: 127.0.0.1 diff --git a/mallinkAdmin/src/main/resources/application-test.yml b/mallinkAdmin/src/main/resources/application-test.yml index 9508fdc07..f6d7426ea 100644 --- a/mallinkAdmin/src/main/resources/application-test.yml +++ b/mallinkAdmin/src/main/resources/application-test.yml @@ -21,7 +21,7 @@ spring: testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 - connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" + connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=60000" # REDIS redis: host: 127.0.0.1 diff --git a/mallinkAdmin/src/main/resources/application.yml b/mallinkAdmin/src/main/resources/application.yml index 0d5ba7966..8ece18bf3 100644 --- a/mallinkAdmin/src/main/resources/application.yml +++ b/mallinkAdmin/src/main/resources/application.yml @@ -60,7 +60,7 @@ mybatis: lazy-loading-enabled: true use-generated-keys: true default-fetch-size: 100 - default-statement-timeout: 10 + default-statement-timeout: 10000 #PageHelper diff --git a/mallinkAdmin/src/main/resources/db/migration/V201906251400__ADD_CONDITION_FOR_COUPON.sql b/mallinkAdmin/src/main/resources/db/migration/V201906251400__ADD_CONDITION_FOR_COUPON.sql new file mode 100644 index 000000000..cf2e0042a --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201906251400__ADD_CONDITION_FOR_COUPON.sql @@ -0,0 +1,4 @@ +ALTER TABLE `wx_c_user_basic_info` +ADD COLUMN `act_record` INT(11) NULL DEFAULT '0' AFTER `active_time`; +ALTER TABLE `wx_coupon` +ADD COLUMN `condition` JSON NULL DEFAULT NULL AFTER `is_del`; \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V201906251500__CHANGE_CONDITION_COLUMN.sql b/mallinkAdmin/src/main/resources/db/migration/V201906251500__CHANGE_CONDITION_COLUMN.sql new file mode 100644 index 000000000..f4d29b946 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201906251500__CHANGE_CONDITION_COLUMN.sql @@ -0,0 +1,2 @@ +ALTER TABLE `wx_coupon` +CHANGE COLUMN `condition` `conditions` JSON NULL DEFAULT NULL ; \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V201906251622__L_ALTER_FLOW.sql b/mallinkAdmin/src/main/resources/db/migration/V201906251622__L_ALTER_FLOW.sql new file mode 100644 index 000000000..767dcfff9 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201906251622__L_ALTER_FLOW.sql @@ -0,0 +1,8 @@ +ALTER TABLE `wx_coupon` +ADD COLUMN `put_apply_status` SMALLINT(1) NULL DEFAULT 0 COMMENT '投放审核状态0未审核1审核中2审核完成3驳回4异常终止5撤回'; + +ALTER TABLE `wx_coupon` +ADD COLUMN `stock_apply_status` SMALLINT(1) NULL DEFAULT 0 COMMENT '库存审核状态0未审核1审核中2审核完成3驳回4异常终止5撤回'; + +ALTER TABLE `wx_coupon` +ADD COLUMN `cancle_apply_status` SMALLINT(1) NULL DEFAULT 0 COMMENT '作废审核状态0未审核1审核中2审核完成3驳回4异常终止5撤回'; \ No newline at end of file diff --git a/mallinkAdmin/src/main/resources/db/migration/V201906260131__COUPON_PRESS_DATA.sql b/mallinkAdmin/src/main/resources/db/migration/V201906260131__COUPON_PRESS_DATA.sql new file mode 100644 index 000000000..a5afa72b9 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201906260131__COUPON_PRESS_DATA.sql @@ -0,0 +1,18 @@ +CREATE TABLE `wx_coupon_press_data` ( + `id` bigint(20) NOT NULL COMMENT '主键ID', + `tenant_id` varchar(10) NOT NULL COMMENT '租户ID', + `cover_img` varchar(1024) NOT NULL COMMENT '封面图', + `title` varchar(50) NOT NULL COMMENT '券名称', + `sale_price` int(11) NOT NULL COMMENT '售价(适用于类型2,3,4,5)', + `price` int(11) NOT NULL COMMENT '面额', + `change_rate` varchar(10) NULL default null COMMENT '转化率', + `press_count` varchar(10) NULL default null COMMENT '砍价发起次数', + `press_succ_count` varchar(10) NULL default null COMMENT '1.主动领取2.定向投放', + `join_count` varchar(10) NULL default null COMMENT '参与人次', + `payment_rate` varchar(10) NULL DEFAULT NULL COMMENT '核销比', + PRIMARY KEY (`id`), + UNIQUE `id_UNIQUE` USING BTREE (`id`) comment '' +) ENGINE=`InnoDB` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='砍价营销数据' CHECKSUM=0 DELAY_KEY_WRITE=0; + +insert into `wx_coupon_press_data`(`id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price`) +select `id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price` from wx_coupon where type = 8; \ No newline at end of file diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index 2f5b4a698..8102b3f55 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -1,16 +1,18 @@ package com.iformall.controller; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.domain.dto.OrderSaveDto; import com.iformall.domain.po.*; -import com.iformall.domain.vo.WxMerchantVo; +import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxOrderCouponPressVo; import com.iformall.domain.vo.WxOrderCouponVo; import com.iformall.enums.*; import com.iformall.exception.MallinkException; +import com.iformall.service.WxCUserBasicInfoService; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; import com.iformall.service.WxOrderService; @@ -44,6 +46,9 @@ public class WxOrderController extends BaseController { @Autowired private WxCouponService wxCouponService; + @Autowired + private WxCUserBasicInfoService wxCUserBasicInfoService; + @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\",\"press\":\"String\",\"orderGroupId\":\"String\",\"formId\":\"String\"}") @PostMapping("save") public ResultData saveOrder(@RequestBody OrderSaveDto orderSaveDto) { @@ -52,9 +57,17 @@ public class WxOrderController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); } WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId()); + if (wxCouponChannel == null) { + logger.error("couponChannelId find error, " + orderSaveDto.getCouponChannelId()); + return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); + } ResultData resultData = couponChannelCheck(orderSaveDto, wxCouponChannel); if (resultData != null) return resultData; + WxCUser user = getUser(); + resultData = couponUserCheck(user, wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId())); + if (resultData != null) return resultData; + Long couponId = orderSaveDto.getCouponId() == null ? wxCouponChannel.getCouponId() : orderSaveDto.getCouponId(); if (couponId == null) { logger.error("couponChannelId或者couponId不能为空"); @@ -63,7 +76,6 @@ public class WxOrderController extends BaseController { // 是否砍价 boolean isPress = orderSaveDto.getPress() != null ? orderSaveDto.getPress() : false; - WxCUser user = getUser(); try { WxCoupon coupon = wxCouponService.getById(couponId); @@ -81,12 +93,39 @@ public class WxOrderController extends BaseController { } } - private ResultData couponChannelCheck(@RequestBody OrderSaveDto orderSaveDto, WxCouponChannel wxCouponChannel) { - if (wxCouponChannel == null) { - logger.error("couponChannelId convert error, " + orderSaveDto.getCouponChannelId()); - return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR); + private ResultData couponUserCheck(WxCUser user, WxCouponCVo coupon) { + if (coupon.getConditions() == null) return null; + JSONObject jo = null; + try { + jo = JSONObject.parseObject(coupon.getConditions()); + } catch (Exception e) { + logger.error("购买券条件判断错误:ID=" + coupon.getId() + e.getMessage()); } + if (jo != null) { + if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()){ + WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); + if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0) + return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); + }else if (jo.getIntValue("type") == EnumCouponConditionType.SCORE_SCOPE.getCode()){ + int max = jo.getIntValue("max"); + int min = jo.getIntValue("min"); + if (max!=0 && min ==0 && user.getScore() > max) { + return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); + } + if (max==0 && min !=0 && user.getScore() < min) { + return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); + } + if (max!=0 && min !=0 && (user.getScore() < min || user.getScore() > max)) { + return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); + } + } + } + + return null; + } + + private ResultData couponChannelCheck(@RequestBody OrderSaveDto orderSaveDto, WxCouponChannel wxCouponChannel) { if (wxCouponChannel.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { Date now = new Date(); if (wxCouponChannel.getBeginTime().getTime() > now.getTime()) { diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index d2b507da8..d2ca98021 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -186,7 +186,8 @@ public class WxUserGrantController extends BaseController { String session_key = null; String openId = null; String unionId = null; - boolean bHaveUnionId = false; + boolean boolHaveUnionId = false; + boolean boolFindByUnionId = false; Long userId = null; try { @@ -196,7 +197,7 @@ public class WxUserGrantController extends BaseController { openId = session.getOpenid(); unionId = session.getUnionid(); if (StringUtils.isNotBlank(unionId)) { - bHaveUnionId = true; + boolHaveUnionId = true; } logger.info("session_key: " + session_key + ", openId: " + openId + ", unionId: " + unionId); @@ -213,24 +214,26 @@ public class WxUserGrantController extends BaseController { newUser.setTenantId(wxAuthorizerInfo.getTenantId()); newUser.setAppId(appId); newUser.setOpenId(openId); - if (bHaveUnionId) { + if (boolHaveUnionId) { newUser.setUnionId(unionId); } WxCUser oldUser = null; - if (bHaveUnionId) { + if (boolHaveUnionId) { // 优先根据unionId查询 WxCUser userQ = new WxCUser(); userQ.setTenantId(wxAuthorizerInfo.getTenantId()); userQ.setUnionId(unionId); oldUser = wxCUserService.getByObject(userQ); + if(oldUser != null) { + boolFindByUnionId = true; + } } if (oldUser == null) { oldUser = wxCUserService.getByOpenId(newUser); } if (oldUser != null) { // 已有用户 - userId = oldUser.getId(); token = oldUser.createToken(new Date()); resultMap.put("token", token); @@ -241,7 +244,7 @@ public class WxUserGrantController extends BaseController { oldUser.setSessionKey(session_key); oldUser.setAppId(appId); oldUser.setOpenId(openId); - if (bHaveUnionId) { + if (boolHaveUnionId) { oldUser.setUnionId(unionId); } if (StringUtils.isNotBlank(wxAuthorizerInfo.getOpenAppid())) { @@ -272,9 +275,10 @@ public class WxUserGrantController extends BaseController { userTokenService.saveOrUpdate(oldUser); // 登录后处理 - int score = wxCUserService.actionAfterLogin(oldUser); + int score = wxCUserService.actionAfterLogin(oldUser, boolFindByUnionId); resultMap.put("score", score); } else { + // 新用户 newUser.setTenantId(wxAuthorizerInfo.getTenantId()); token = newUser.createToken(new Date()); @@ -309,7 +313,7 @@ public class WxUserGrantController extends BaseController { request.setAttribute(Constant.TENANT_ID, newUser.getTenantId()); // 登录后处理 - int score = wxCUserService.actionAfterLogin(newUser); + int score = wxCUserService.actionAfterLogin(newUser, null); resultMap.put("score", score); } diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 6dcbe937d..7ef2fb294 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -110,6 +110,9 @@ public enum ErrorCode{ COUPON_VALID_DATE_ERR(2035, "券有效期设置错误"), COUPON_STOCK_VALID_DATE_SETTING_ERR(2036, "券库存有效期未修改"), COUPON_STOCK_DATE_NO_CAR(2037, "券库存不支持停车券"), + COUPON_ONLY_FOR_NEW_MEMBER(2038, "您已参加过新会员活动"), + COUPON_SCORE_NOT_IN_RANGE(2038, "您的成长值/等级与要求不符"), + COUPON_STOCK_NO_EQUAL_ERR(2039, "券库存设置要保证同增同减"), PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"), PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"), diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponChannelDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponChannelDto.java index e99a5a518..0a5829898 100644 --- a/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponChannelDto.java +++ b/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponChannelDto.java @@ -2,8 +2,10 @@ package com.iformall.domain.dto; import lombok.Data; +import javax.persistence.Transient; import java.io.Serializable; import java.util.Date; +import java.util.Map; @Data @@ -14,4 +16,9 @@ public class WxCouponChannelDto implements Serializable { private String channelId; private Date beginTime; private Date endTime; + + @Transient + @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") + private Map flowParams; + } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxBusiness.java b/mallinkService/src/main/java/com/iformall/domain/po/WxBusiness.java index 6780d8739..8fdcf0dd3 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxBusiness.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxBusiness.java @@ -31,6 +31,14 @@ public class WxBusiness implements Serializable { @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; + @Transient + @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate") + private Date startdate; + + @Transient + @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") + private Date enddate; + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index 7bcd4b417..57c10b718 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -101,6 +101,9 @@ public class WxCUserBasicInfo extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value="积分",name="credit") private Integer credit; + @io.swagger.annotations.ApiModelProperty(value="活动记录",name="actRecord") + private Integer actRecord; + @Transient @Excel(name="标签",width = 50,orderNum = "10") private String tagNames; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index 971213ab9..166a7274f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -13,6 +13,7 @@ import javax.persistence.Transient; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import java.util.Map; @Table(name = "wx_coupon") @Data @@ -142,6 +143,10 @@ public class WxCoupon extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value="过期退积分(0:正常,1不退)",name="autoRefund") private Integer creditRefund; + @io.swagger.annotations.ApiModelProperty(value="领取条件",name="condition") + private String conditions; + + @Transient private String merchantParams; @@ -167,6 +172,13 @@ public class WxCoupon extends BaseEntity { //营销分析 private WxCouponStatisVo wxCouponStatisVo; + @io.swagger.annotations.ApiModelProperty(value="投放审批状态",name="putApplyStatus") + private Integer putApplyStatus; + @io.swagger.annotations.ApiModelProperty(value="库存审批状态",name="stockApplyStatus") + private Integer stockApplyStatus; + @io.swagger.annotations.ApiModelProperty(value="作废审批状态",name="cancleApplyStatus") + private Integer cancleApplyStatus; + @Transient @SortColumn(column = "press_count") private Integer pressSendCount; @@ -194,6 +206,10 @@ public class WxCoupon extends BaseEntity { @Transient private Integer pressSuccCount; + @Transient + @io.swagger.annotations.ApiModelProperty(value = "审批流参数", name = "flowParams") + private Map flowParams; + @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") private Integer isDel; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCLoginMsg.java b/mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCLoginMsg.java index e03c813c6..8b4209abb 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCLoginMsg.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCLoginMsg.java @@ -14,4 +14,7 @@ public class FmInsideCLoginMsg extends BaseMsg{ private String tenantId; @io.swagger.annotations.ApiModelProperty(value = "用户ID", name = "cUserId") private Long cUserId; + + @io.swagger.annotations.ApiModelProperty(value = "是否从unionId更新", name = "findByUnionId") + private Boolean findByUnionId; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java index 681eb130c..825749455 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponChannelVo.java @@ -66,6 +66,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { @io.swagger.annotations.ApiModelProperty(value="积分售价(适用于类型10,11)",name="creditPrice") private Integer creditPrice; + @io.swagger.annotations.ApiModelProperty(value="领取条件",name="condition") + private String conditions; + @Transient private String salePriceStr; diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java index ed400f188..2bbe494f9 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponOrderBVo.java @@ -9,6 +9,8 @@ import lombok.ToString; import javax.persistence.Id; import javax.persistence.Transient; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.Date; import java.util.List; @@ -20,7 +22,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ private static final long serialVersionUID = 6687954932922444531L; @Id - @Excel(name="券码",width = 20) + @Excel(name = "券码", width = 20, orderNum = "1") protected Long id; @Override @@ -33,38 +35,45 @@ public class WxCouponOrderBVo extends WxCouponOrder{ @io.swagger.annotations.ApiModelProperty(value = "", name = "tenantId") private String tenantId; - @Excel(name="订单号",width = 20) @io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId") private Long orderId; @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") private Date expiredTime; - @Excel(name="券名称",width = 50) + @Excel(name = "券名称", width = 50, orderNum = "2") @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") private String title; - @Excel(name="用户手机号",width = 20) + public String getcUserPhone() { + return cUserPhone; + } + + public void setcUserPhone(String cUserPhone) { + this.cUserPhone = cUserPhone; + } + + @Excel(name = "会员手机号", width = 20, orderNum = "13") @io.swagger.annotations.ApiModelProperty(value="c用户绑定的手机号",name="cUserPhone") private String cUserPhone; - @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss") + @Excel(name = "交易时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "8") @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") private Date createDate; @Transient - @Excel(name="面额",width = 20) + @Excel(name = "面额(元)", width = 20, orderNum = "6") private String priceStr; @Transient - @Excel(name="交易价格",width = 20) + @Excel(name = "交易价格(元)", width = 20, orderNum = "5") private String salePriceStr; - @Excel(name="订单状态",width = 20,replace = { "可以退款_0", "已经使用_1","已经过期_2","已经退款_3"}) + @Excel(name = "状态", width = 20, replace = {"可以退款_0", "已经使用_1", "已经过期_2", "已经退款_3"}, orderNum = "14") @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") private Integer couponOrderStatus; - @Excel(name="核销/过期/退款时间",width = 20,exportFormat="yyyy-MM-dd HH:mm:ss") + @Excel(name = "核销/过期/退款时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "9") @io.swagger.annotations.ApiModelProperty(value = "", name = "updateDate") private Date updateDate; @@ -81,17 +90,36 @@ public class WxCouponOrderBVo extends WxCouponOrder{ @io.swagger.annotations.ApiModelProperty(value="面额",name="price") private Integer price; + @Excel(name = "所属业态", width = 50, orderNum = "11", replace = {"餐饮_1", "娱乐_2", "服饰_3", "亲子_4", "超市_5", "其它_6", "美妆_7", "珠宝_8", "服务_9", "家居_10"}) + @io.swagger.annotations.ApiModelProperty(value = "业态", name = "business") + private Integer business; + + @io.swagger.annotations.ApiModelProperty(value = "补贴额", name = "subsidyNum") + private Integer subsidyNum; + + public String getSubsidyNumStr() { + return new BigDecimal(subsidyNum == null ? 0 : subsidyNum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN).toPlainString(); + } + + @Excel(name = "补贴额(元)", width = 50, orderNum = "7") + @io.swagger.annotations.ApiModelProperty(value = "补贴额", name = "subsidyNumStr") + private String subsidyNumStr; + + @io.swagger.annotations.ApiModelProperty(value = "补贴类型", name = "subsidyType") + private Integer subsidyType; - @Excel(name="商户管理员(核销人)姓名",width = 50) @io.swagger.annotations.ApiModelProperty(value="b端用户姓名",name="bUserName") private String bUserName; - @Excel(name="商户管理员手机",width = 20) @io.swagger.annotations.ApiModelProperty(value="b端用户手机号",name="bUserPhone") private String bUserPhone; - @Excel(name="使用券商户名",width = 50) + @Excel(name = "商户名", width = 50, orderNum = "3") @io.swagger.annotations.ApiModelProperty(value="使用券商户名",name="merchantName") private String merchantName; + @Excel(name = "商铺号", width = 50, orderNum = "4") + @Transient + private String shopNumber; + /**发券商户信息*/ @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") private List merchantVoList; @@ -102,12 +130,30 @@ public class WxCouponOrderBVo extends WxCouponOrder{ @Transient private Date endDate; + @Transient + private Long merchantId; + + @Transient + private Date verifyStartDate; + + @Transient + private Date verifyEndDate; + @Transient private Long couponId; @Transient private Integer couponType; - @Override + @Transient + private Integer floor; + @Transient + private Integer building; + + @Excel(name = "楼层楼座", width = 50, orderNum = "12") + @Transient + private String buildingStr; + + @Override public Long getCouponId() { return couponId; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumChart.java b/mallinkService/src/main/java/com/iformall/enums/EnumChart.java index 490e1b008..e21e201f7 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumChart.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumChart.java @@ -61,6 +61,8 @@ public enum EnumChart { INDEX_SALE_DATA(52, "营销数据"), RENT_RATE_HISTORY(53, "商铺出租率走势"), + + BUSINESS(54,"业态分析"), ; public static EnumChart getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponAppType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponAppType.java new file mode 100644 index 000000000..0851c3d19 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponAppType.java @@ -0,0 +1,37 @@ +package com.iformall.enums; + +/** + * Created by luozukai + */ +public enum EnumCouponAppType { + PUT(1, "投放"), + STOCK(2, "库存"), + CANCLE(3, "作废"), + + ; + + public static EnumCouponAppType getEnum(Integer code) { + for (EnumCouponAppType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumCouponAppType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumCouponConditionType.java b/mallinkService/src/main/java/com/iformall/enums/EnumCouponConditionType.java new file mode 100644 index 000000000..b460c6b2d --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/enums/EnumCouponConditionType.java @@ -0,0 +1,37 @@ +package com.iformall.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumCouponConditionType { + + // 0-可投放;1-已作废; + NEW_MEMBER(1, "新会员"), + SCORE_SCOPE(2, "积分值"), + ; + + public static EnumCouponConditionType getEnum(Integer code) { + for (EnumCouponConditionType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumCouponConditionType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java index ac19428cf..338bab9b7 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java @@ -38,5 +38,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper sceneDataMap(HashMap params); // will be deleted + void updateCreateTimeMd(HashMap params); + List getSceneDataMap(HashMap params); List sceneDataMapJoinCouponOrder(HashMap params); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java index 068ef8c1e..a3b013a34 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java @@ -10,7 +10,15 @@ import com.iformall.domain.po.WxCoupon; public interface WxCouponMapper extends CommonMapper { List findPressData(WxCoupon wxCoupon); - List findCouponData(WxCoupon wxCoupon); + void delPressData(WxCoupon wxCoupon); + void insertPressData(WxCoupon wxCoupon); + void updatePressData1(WxCoupon wxCoupon); + void updatePressData2(WxCoupon wxCoupon); + void updatePressData3(WxCoupon wxCoupon); + void updatePressData4(WxCoupon wxCoupon); + void updatePressData5(WxCoupon wxCoupon); + + List findCouponData(WxCoupon wxCoupon); List findCountData(WxCoupon wxCoupon); List findList(WxCoupon wxCoupon); @@ -21,6 +29,8 @@ public interface WxCouponMapper extends CommonMapper { void reduceInventory(@Param("id")Long id,@Param("number")Integer number); + void backInventory(@Param("id")Long id,@Param("remainInventory")Integer remainInventory, @Param("number")Integer number); + void offExpiriedCouponByValidDate(); void offExpiriedCouponByMerchantStatus(); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java index 6c16276e7..4bf7aeb5c 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java @@ -6,6 +6,7 @@ import com.iformall.domain.vo.WxMerchantVo; import java.util.HashMap; import java.util.List; +import java.util.Map; public interface WxMerchantMapper extends CommonMapper { @@ -16,4 +17,6 @@ public interface WxMerchantMapper extends CommonMapper { WxMerchant queryMerchantByMerchantIdOfSharingReceiver(WxMerchant wxMerchant); List findQrcodeEmptyList(); + + List> findBusByFloorId(Map params); } diff --git a/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java b/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java index f9dd20ffd..cfc19a689 100644 --- a/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java +++ b/mallinkService/src/main/java/com/iformall/mq/impl/RabbitMqMessageProducer.java @@ -13,7 +13,6 @@ import org.springframework.amqp.core.AmqpTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; - import java.util.UUID; /** @@ -32,7 +31,6 @@ public class RabbitMqMessageProducer implements MqBaseProducer { @Autowired private WxMsgRecordService wxMsgRecordService; - @Override public void sendMessage(BaseMsg data, String topic, String tags, String keys) { try { diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserService.java index 196385321..c7a4638b5 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserService.java @@ -110,14 +110,14 @@ public interface WxCUserService { * 登录后发消息 * @param user */ - void actionMsgAfterLogin(WxCUser user); + void actionMsgAfterLogin(WxCUser user, Boolean findByUnionId); /** * 登录后处理 * @param user * @return */ - int actionAfterLogin(WxCUser user); + int actionAfterLogin(WxCUser user, Boolean findByUnionId); /** * 积分 diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java index 4ca99cc6b..339507e93 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java @@ -152,9 +152,6 @@ public interface WxCouponOrderService { ResultData detailAdminVo(Long couponOrderId); - void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder); - - /** * 日期分组 消费总数 * @param tenantId @@ -190,4 +187,6 @@ public interface WxCouponOrderService { ResultData queryCardStatus(WxCouponOrder wxCouponOrder); + void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java index 39029ec61..cb260e70c 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponService.java @@ -61,7 +61,12 @@ public interface WxCouponService { * @param record */ ResultData saveOrUpdate(WxCoupon record); - + /** + * 更新实体 + * + * @param record + */ + void update(WxCoupon record); /** * 根据Id删除实体 * diff --git a/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java index c11425bb5..af9893e64 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java @@ -158,7 +158,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { params.put("startTime", addDay(-30)); params.put("endTime", addDay(1)); //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 - // TODO DELETE sceneDataMap + wxCouponActionLogMapper.updateCreateTimeMd(params); List sceneList = wxCouponActionLogMapper.getSceneDataMap(params); //停车发券被核销数 @@ -207,7 +207,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { MarkingSceneDataReportVo msdVo = new MarkingSceneDataReportVo(); msdVo.setXTime(tj); Optional carStop = sceneList.stream().filter(c -> c.getXTime().equals(tj) && c.getChannelType() == EnumCouponSendSendType.CAR_STOP.getCode()).findFirst(); - if(!carStop.isPresent()) { + if (!carStop.isPresent()) { msdVo.setParkSendCount(0); } else { MarkingSceneDataReportTVo tvo = carStop.get(); @@ -237,6 +237,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { MarkingSceneDataReportTVo tvo = orderSend.get(); msdVo.setOrderSendCount(tvo.getCount()); } + msdVo.setTotal(msdVo.getParkSendCount() + msdVo.getVerifySendCount() + msdVo.getMicroPaySendCount() + diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java index 59a49ed98..08430b006 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDailyServiceImpl.java @@ -52,8 +52,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { WxMerchantShopMapper wxMerchantShopMapper; @Override public PageInfo> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - updateBillStatus(record); //分页对象设置页数和条数 PageHelper.startPage(pageIndex, pageSize); //查询 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java index 36d873166..5ea8e9028 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillDepositServiceImpl.java @@ -44,8 +44,6 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { @Override public PageInfo> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - //updateBillStatus(record); PageHelper.startPage(pageIndex, pageSize); List> billDepositList = wxBillDepositMapper.queryBillDepositList(record); PageInfo> pageInfo = new PageInfo<>(billDepositList); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java index 079d54ee2..7a88b8b1e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherDepositServiceImpl.java @@ -44,8 +44,6 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService @Override public PageInfo> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - //updateBillStatus(record); //分页对象设置页数和条数 PageHelper.startPage(pageIndex, pageSize); //查询 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java index e98e91f80..3783dd1c7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillOtherServiceImpl.java @@ -43,8 +43,6 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { @Override public PageInfo> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - updateBillStatus(record); //分页对象设置页数和条数 PageHelper.startPage(pageIndex, pageSize); //查询 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java index 52cad67d8..b83c03e89 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyDepositServiceImpl.java @@ -43,8 +43,6 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe @Override public PageInfo> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - //updateBillStatus(record); PageHelper.startPage(pageIndex, pageSize); List> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); PageInfo> pageInfo = new PageInfo<>(billDepositList); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java index 48e3cfba9..ef20d0220 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillPropertyServiceImpl.java @@ -43,8 +43,6 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { @Override public PageInfo> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - //updateBillStatus(record); PageHelper.startPage(pageIndex, pageSize); List> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); PageInfo> pageInfo = new PageInfo<>(billRentList); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java index ed98b2fc9..f3036f158 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillRentServiceImpl.java @@ -43,8 +43,6 @@ public class WxBillRentServiceImpl implements WxBillRentService { @Override public PageInfo> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { - //更新账单状态 - updateBillStatus(record); PageHelper.startPage(pageIndex, pageSize); List> billRentList = wxBillRentMapper.queryBillRentList(record); PageInfo> pageInfo = new PageInfo<>(billRentList); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java index 57ec31d7a..5bdeac54c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java @@ -9,7 +9,6 @@ import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.WxCUserBasicInfo; import com.iformall.domain.po.WxCreditHistory; import com.iformall.domain.po.msg.FmInsideCLoginMsg; -import com.iformall.domain.po.msg.FmInsideCouponVerifyMsg; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxCUserMapper; @@ -23,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.List; @Service public class WxCUserServiceImpl implements WxCUserService { @@ -216,17 +216,18 @@ public class WxCUserServiceImpl implements WxCUserService { } @Override - public void actionMsgAfterLogin(WxCUser user) { + public void actionMsgAfterLogin(WxCUser user, Boolean findByUnionId) { FmInsideCLoginMsg loginMsg = new FmInsideCLoginMsg(); loginMsg.setMsgType(EnumMsgRecordType.INSIDE_C_LOGIN.getCode()); loginMsg.setTenantId(user.getTenantId()); loginMsg.setCUserId(user.getId()); + loginMsg.setFindByUnionId(findByUnionId); mqBaseProducer.sendMessage(loginMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); } @Override - public int actionAfterLogin(WxCUser user) { + public int actionAfterLogin(WxCUser user, Boolean findByUnionId) { int score = 0; int credit = 0; // 成长值 @@ -267,6 +268,23 @@ public class WxCUserServiceImpl implements WxCUserService { saveOrUpdate(cUser); } } + // 用户从unionId来的,可能会有重复 + if(findByUnionId != null) { + if(findByUnionId) { + WxCUser userQ = new WxCUser(); + userQ.setOpenAppId(user.getAppId()); + userQ.setOpenId(user.getOpenId()); + List userList = wxCUserMapper.findList(userQ); + if(userList.size() > 1) { + for(WxCUser tempUser: userList) { + if(tempUser.getUnionId() == null) { + // 删除 无unionId的用户 + wxCUserMapper.deleteByPrimaryKey(tempUser.getId()); + } + } + } + } + } return score; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java index dc7fd1472..8a3cb9819 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCampaignServiceImpl.java @@ -276,9 +276,11 @@ public class WxCampaignServiceImpl implements WxCampaignService { String param = couponChannel.getWeappScene(); ResultData resultDataQ = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); Map map = (Map)resultDataQ.data; - String url = map.get("url"); - couponChannel.setQrCode(url); - wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + couponChannel.setQrCode(url); + wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + } } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index ec624ade4..40c850831 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -12,6 +12,7 @@ import com.iformall.domain.vo.*; import com.iformall.enums.*; import com.iformall.mapper.*; import com.iformall.service.MarkingDataReportService; +import com.iformall.service.WxBusinessService; import com.iformall.service.WxChartDataService; import com.iformall.service.WxCouponService; import com.iformall.utils.DateUtils; @@ -76,6 +77,8 @@ public class WxChartServiceImpl implements WxChartDataService { WxBillAllMapper wxBillAllMapper; @Autowired MarkingDataReportService markingDataReportService; + @Autowired + WxBusinessService wxBusinessService; @Override public ResultData queryData(Map paramsMap) { @@ -312,9 +315,35 @@ public class WxChartServiceImpl implements WxChartDataService { return getRentRateHistory(tenantId,paramsMap); } + //业务分析 + if (chart.equals(EnumChart.BUSINESS.getCode())) { + return getBusiness(tenantId,paramsMap); + } + return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); } + /** + * 业态分析 + * @param tenantId + * @return + */ + private ResultData getBusiness(String tenantId,Map paramsMap){ + Map resultMap = new LinkedMap(); + List businessList = wxBusinessService.findList(new WxBusiness()); + for (WxBusiness b:businessList) { + resultMap.put(b.getTitle(),0l); + } + Map query = new HashedMap(); + query.put("tenantId",tenantId); + query.put("id",paramsMap.get("id")); + List> mapList = wxMerchantMapper.findBusByFloorId(query); + for (Map map:mapList) { + resultMap.put((String)map.get("btitle"),(Long)map.get("count")); + } + return new ResultData(resultMap); + } + /** * 首页商铺出租率走势 * @param tenantId @@ -339,7 +368,7 @@ public class WxChartServiceImpl implements WxChartDataService { List days = DateUtils.getTjTimeList(startTime, endTime, 1==dateType.intValue()?"0":"1"); Map map = getMap(days); for (Map m : mapList) { - map.put((String)m.get("xTime"),(Long)m.get("xCount")); + map.put((String)m.get( "xTime"),(Long)m.get("xCount")); } double all = allList.size(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java index 6b151e13a..c134311ce 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java @@ -16,10 +16,8 @@ import com.iformall.enums.*; import com.iformall.mapper.WxCouponChannelMapper; import com.iformall.mapper.WxCouponMerchantMapper; import com.iformall.mapper.WxMerchantMapper; -import com.iformall.service.WxCouponChannelService; -import com.iformall.service.WxCouponService; -import com.iformall.service.WxOrderService; -import com.iformall.service.WxScreenAdService; +import com.iformall.service.*; +import org.checkerframework.checker.units.qual.A; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -43,6 +41,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { WxScreenAdService wxScreenAdService; @Autowired WxOrderService wxOrderService; + @Autowired + QrCodeService qrCodeService; /** * B端业务端 @@ -230,6 +230,19 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { vo.setId(channel.getId()); vo.setType(channel.getType()); vo.setSuc(true); + + String pageUrl = "pages/index/index"; + WxCouponChannel couponChannel = new WxCouponChannel(); + couponChannel.setId(vo.getId()); + couponChannel.setType(vo.getType()); + String param = couponChannel.getWeappScene(); + ResultData resultDataQ = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); + Map map = (Map)resultDataQ.data; + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + couponChannel.setQrCode(url); + wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + } return vo; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index 41d92d7c6..cca9c20d2 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -20,7 +20,6 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.mq.MqBaseProducer; import com.iformall.service.*; -import com.iformall.utils.DateUtils; import com.iformall.utils.PayUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -272,12 +271,27 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { } @Override - public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder) { - WxMall wxMall = new WxMall(); - wxMall.setTenantId(wxCouponOrder.getTenantId()); - wxMall = wxMallMapper.findList(wxMall).get(0); - String filename = wxMall.getName() + DateUtils.getSystemTime("yyyyMMDDHHmmss"); + public void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) { + String filename = "券订单"; List list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); + list.parallelStream().forEach(c -> { + if (!c.getMerchantId().equals(0L)) { + List merchantVoList = c.getMerchantVoList(); + if (!merchantVoList.isEmpty()) { + StringBuffer shopNumber = new StringBuffer(); + StringBuffer building = new StringBuffer(); + WxMerchantVo wxMerchantVo = merchantVoList.get(0); + List shopVoList = wxMerchantVo.getShopVoList(); + for (int j = 0, s_size = shopVoList.size(); j < s_size; j++) { + WxShopVo wxShopVo = shopVoList.get(j); + shopNumber.append(wxShopVo.getShopNumber()).append(";"); + building.append(wxShopVo.getBuildingName()).append(wxShopVo.getFloorName()).append(";"); + } + c.setShopNumber(shopNumber.toString()); + c.setBuildingStr(building.toString()); + } + } + }); excelService.exportExcel(list, null, filename, WxCouponOrderBVo.class, filename + ".xlsx", response, false); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java index 6349d81f4..92d0ed02d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java @@ -303,7 +303,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { mqBaseProducer.sendMessage(mpAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); } catch (Exception e) { logger.error("购票成功-公众号-模板消息发送失败: " + e.getMessage()); - throw new MallinkException(ErrorCode.MP_TEMPLATE_SEND_FAILED); + //throw new MallinkException(ErrorCode.MP_TEMPLATE_SEND_FAILED); } } else { // 可能未关注公众号, 用户可能收不到 @@ -334,7 +334,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { mqBaseProducer.sendMessage(appUniformMsg, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); } catch (Exception e) { logger.error("核销-公众号-模板消息发送失败: " + e.getMessage()); - throw new MallinkException(ErrorCode.UNIFORM_SEND_FAILED); + //throw new MallinkException(ErrorCode.UNIFORM_SEND_FAILED); } } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 8a8a3f499..a923a3000 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -293,6 +293,18 @@ public class WxCouponServiceImpl implements WxCouponService { wxCouponMapper.insertSelective(record); } else { + if(record.getInventory() != null && record.getRemainInventory() != null) { + // 库存修改检查 + WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(record.getId()); + if(oldCoupon.getRemainInventory() == record.getRemainInventory()) { + // 库存未变, 不更新库存 + record.setRemainInventory(null); + record.setInventory(null); + } else { + // 库存增加,要同时增加, 库存减少,要同时减少 + record.setInventory(oldCoupon.getInventory() + record.getRemainInventory() - oldCoupon.getRemainInventory()); + } + } if (merchantParamList != null && merchantParamList.size() > 0) { WxCouponMerchant cmParam = new WxCouponMerchant(); cmParam.setProductId(record.getId()); @@ -442,6 +454,15 @@ public class WxCouponServiceImpl implements WxCouponService { @Override public PageInfo findPressData(WxCoupon record, Integer pageNum, Integer pageSize) { + if(pageNum == 0) { + wxCouponMapper.delPressData(record); + wxCouponMapper.insertPressData(record); + wxCouponMapper.updatePressData1(record); + wxCouponMapper.updatePressData2(record); + wxCouponMapper.updatePressData3(record); + wxCouponMapper.updatePressData4(record); + wxCouponMapper.updatePressData5(record); + } return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.findPressData(record)); } @@ -558,6 +579,11 @@ public class WxCouponServiceImpl implements WxCouponService { wxCoupon.setOrgInventory(oldCoupon.getInventory()); wxCoupon.setOrgRemainInventory(oldCoupon.getRemainInventory()); + if((wxCoupon.getRemainInventory() - wxCoupon.getOrgRemainInventory()) != (wxCoupon.getInventory() - wxCoupon.getOrgInventory())) { + // 库存要保证,同增同减 + logger.error("券库存要保证同增同减"); + return new ResultData(ErrorCode.COUPON_STOCK_NO_EQUAL_ERR); + } int ret = wxCouponMapper.updateStockAndValidDate(wxCoupon); if(ret != 1) { @@ -576,4 +602,8 @@ public class WxCouponServiceImpl implements WxCouponService { return new ResultData(); } + @Override + public void update(WxCoupon record) { + wxCouponMapper.updateByPrimaryKeySelective(record); + } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java index 9c938a750..fa6346793 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxFlowServiceImpl.java @@ -14,10 +14,7 @@ import com.iformall.domain.vo.FlowUserVo; import com.iformall.domain.vo.UserTaskVo; import com.iformall.domain.vo.WxBillAll; import com.iformall.enums.*; -import com.iformall.mapper.WxFlowConfigMapper; -import com.iformall.mapper.WxFlowModelMapper; -import com.iformall.mapper.WxFlowRecordMapper; -import com.iformall.mapper.WxPropertyContractMapper; +import com.iformall.mapper.*; import com.iformall.mq.MqBaseProducer; import com.iformall.service.*; import com.iformall.utils.Constant; @@ -84,6 +81,12 @@ public class WxFlowServiceImpl implements WxFlowService { private WxFlowConfigMapper wxFlowConfigMapper; @Autowired private WxBillAllService wxBillAllService; + @Autowired + private WxCouponMapper wxCouponMapper; + @Autowired + private WxCouponService wxCouponService; + @Autowired + private WxCouponChannelService wxCouponChannelService; /** * 获取流程key @@ -114,6 +117,7 @@ public class WxFlowServiceImpl implements WxFlowService { Boolean supplement = (Boolean)mapInfo.get("supplement"); Integer contractType = 0; String str = (String)getVariableByKey(variables,"contractType"); + Integer operateType = (Integer)getVariableByKey(variables,"operateType"); if(StringUtils.isNotBlank(str)){ contractType = Integer.parseInt(str); } @@ -134,7 +138,7 @@ public class WxFlowServiceImpl implements WxFlowService { if(supplement!=null && supplement && EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { wxRentContractService.updateRentContractStatus(businessId); } - }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType) || EnumFlowContractType.PROPERTY_POINT.getCode().equals(contractType)){ + }else if(EnumFlowContractType.PROPERTY.getCode().equals(contractType) || EnumFlowContractType.PROPERTY_POINT.getCode().equals(contractType)){ WxPropertyContract wxPropertyContract = new WxPropertyContract(); wxPropertyContract.setId(businessId); wxPropertyContract.setApplyStatus(applyStatus); @@ -190,6 +194,60 @@ public class WxFlowServiceImpl implements WxFlowService { wxBillAll.setNewPrice(newPrice); wxBillAllService.updateReceivePay(wxBillAll, user); } + } else if (EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType) + || EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType) + || EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType) + || EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)) { + WxCoupon wxCoupon = new WxCoupon(); + wxCoupon.setId(businessId); + wxCoupon.setUpdateDate(new Date()); + + if(EnumCouponAppType.PUT.getCode().equals(operateType)){ + wxCoupon.setPutApplyStatus(applyStatus); + String idsV = (String)getVariableByKey(variables,"ids"); + String channelIdV = (String)getVariableByKey(variables,"channelId"); + String[] ids = idsV.split(","); + String[] channelId = channelIdV.split(","); + Date beginTime = (Date)getVariableByKey(variables,"beginTime"); + Date endTime = (Date)getVariableByKey(variables,"endTime"); + String tenantId = (String)getVariableByKey(variables,"tenantId"); + wxCouponChannelService.addBatch(ids, channelId, tenantId, beginTime,endTime); + }else if(EnumCouponAppType.STOCK.getCode().equals(operateType)){ + wxCoupon.setStockApplyStatus(applyStatus); + if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue() + ||EnumFlowKey.NEW_CARD_UPLINE.getCode().equals(flowType)) { + //减库存 + if(EnumFlowKey.NEW_COUPON_UPLINE.getCode().equals(flowType)) { + Integer inventory = (Integer) getVariableByKey(variables, "inventory"); + Integer remainInventory = (Integer) getVariableByKey(variables, "remainInventory"); + Integer type = (Integer) getVariableByKey(variables, "type"); + String validDays = (String) getVariableByKey(variables, "validDays"); + Integer validType = (Integer) getVariableByKey(variables, "validType"); + + wxCoupon.setInventory(inventory); + wxCoupon.setRemainInventory(remainInventory); + wxCoupon.setType(type); + wxCoupon.setValidDays(Integer.parseInt(validDays)); + wxCoupon.setValidType(validType); + wxCouponService.updateCouponStockAndEndTime(wxCoupon); + }else if(EnumFlowKey.NEW_GROUP_UPLINE.getCode().equals(flowType)){ + Integer remainInventory = (Integer) getVariableByKey(variables, "remainInventory"); + wxCoupon.setRemainInventory(remainInventory); + wxCouponMapper.updateByPrimaryKeySelective(wxCoupon); + }else if(EnumFlowKey.NEW_PRESS_UPLINE.getCode().equals(flowType)){ + Integer inventory = (Integer) getVariableByKey(variables, "inventory"); + wxCoupon.setInventory(inventory); + wxCouponMapper.updateByPrimaryKeySelective(wxCoupon); + } + } + }else if(EnumCouponAppType.CANCLE.getCode().equals(operateType)){ + wxCoupon.setCancleApplyStatus(applyStatus); + if(EnumRentContractAppStatus.FINISH.getCode().intValue() == applyStatus.intValue()) { + //作废 + wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()); + } + } + wxCouponMapper.updateByPrimaryKeySelective(wxCoupon); } } @@ -255,6 +313,7 @@ public class WxFlowServiceImpl implements WxFlowService { map.put("supplement",supplement); map.put("taskAssignee",flowModel.getFlow()); setSignAssignee(map,flowModel.getFlow()); + map.put("tenantId",tenantId); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowModel.getFlowId(), map); logger.debug("流程启动,流程id:{}",processInstance.getId()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index eef060507..d21c7111b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -313,9 +313,11 @@ public class WxGameServiceImpl implements WxGameService { String param = couponChannel.getWeappScene(); ResultData resultDataQ = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); Map map = (Map)resultDataQ.data; - String url = map.get("url"); - couponChannel.setQrCode(url); - wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + couponChannel.setQrCode(url); + wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + } } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index fcc46fbea..8d34476a3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -1,5 +1,6 @@ package com.iformall.service.impl; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; @@ -114,6 +115,9 @@ public class WxOrderServiceImpl implements WxOrderService { @Autowired private MqBaseProducer mqBaseProducer; + @Autowired + private WxCUserBasicInfoMapper wxCUserBasicInfoMapper; + @Override public PageInfo listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); @@ -197,6 +201,7 @@ public class WxOrderServiceImpl implements WxOrderService { orderQ.setType(EnumOrderType.COUPON.getCode()); orderQ.setCUserId(user.getId()); List statusS = new ArrayList<>(); + statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); @@ -224,6 +229,7 @@ public class WxOrderServiceImpl implements WxOrderService { orderQ.setType(EnumOrderType.COUPON.getCode()); orderQ.setCUserId(user.getId()); List statusS = new ArrayList<>(); + statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); @@ -360,13 +366,8 @@ public class WxOrderServiceImpl implements WxOrderService { throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); } - WxCoupon updateRecord = new WxCoupon(); - updateRecord.setId(coupon.getId()); - updateRecord.setRemainInventory(coupon.getRemainInventory() + 1); - updateRecord.setUpdateDate(new Date()); - try { - wxCouponMapper.updateByPrimaryKeySelective(updateRecord); + wxCouponMapper.backInventory(coupon.getId(), coupon.getRemainInventory(), 1); } catch (Exception e) { logger.error("数据库更新失败,库存+1失败, e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存恢复失败"); @@ -729,6 +730,20 @@ public class WxOrderServiceImpl implements WxOrderService { logger.error("用户不存在, userId: " + updateOrder.getCUserId()); throw new MallinkException(ErrorCode.USER_IS_EMPTY); } + + // 记录活动 + JSONObject jo = null; + try { + jo = JSONObject.parseObject(coupon.getConditions()); + } catch (Exception e) { + logger.error("购买券条件判断错误:ID=" + coupon.getId() + e.getMessage()); + } + if (jo != null) { + if (jo.getIntValue("type") == EnumCouponConditionType.NEW_MEMBER.getCode()) { + wxCUserBasicInfoMapper.incActRecordById(user.getId()); + } + } + sendInsideOrderSuccessMsg(updateOrder, coupon, user); } @@ -839,8 +854,8 @@ public class WxOrderServiceImpl implements WxOrderService { public int updateOrderStatus(WxOrder updateOrder, EnumOrderStatus enumOrderStatus) { Date currentDate = new Date(); switch (enumOrderStatus) { - case ORDER_STATUS_OVERTIME_CANCEL: - case ORDER_STATUS_REFUND_SUCCESS: { + case ORDER_STATUS_OVERTIME_CANCEL: // 支付取消,库存退回 + case ORDER_STATUS_REFUND_SUCCESS: { // 退款成功,库存退回 try { stockBack(updateOrder); } catch (Exception e) { @@ -849,7 +864,7 @@ public class WxOrderServiceImpl implements WxOrderService { } break; } - case ORDER_STATUS_COOPERATING_OVERTIME: { + case ORDER_STATUS_COOPERATING_OVERTIME: { // 拼团超时,退库存 try { stockBack(updateOrder); } catch (Exception e) { @@ -858,7 +873,7 @@ public class WxOrderServiceImpl implements WxOrderService { } break; } - case ORDER_STATUS_COOPERATING_CANCEL: { + case ORDER_STATUS_COOPERATING_CANCEL: { // 拼团取消,退库存 try { stockBack(updateOrder); } catch (Exception e) { @@ -867,7 +882,7 @@ public class WxOrderServiceImpl implements WxOrderService { } break; } - case ORDER_STATUS_COOPERATING_COMPLETE: { + case ORDER_STATUS_COOPERATING_COMPLETE: { // 拼团完成,退库存 try { stockBack(updateOrder); } catch (Exception e) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java index 62357e935..96e6d16d3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxTopicServiceImpl.java @@ -142,9 +142,11 @@ public class WxTopicServiceImpl implements WxTopicService { String param = couponChannel.getWeappScene(); ResultData resultDataQ = qrCodeService.exportQrcode(null,null,couponChannel.getTenantId(),1,pageUrl,param,0,"","","卷",true); Map map = (Map)resultDataQ.data; - String url = map.get("url"); - couponChannel.setQrCode(url); - wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + if(map!=null && map.get("url") !=null) { + String url = map.get("url"); + couponChannel.setQrCode(url); + wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); + } } } diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java index ad0d24044..0fa7610c1 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCLoginMsgServiceImpl.java @@ -41,6 +41,6 @@ public class FmInsideCLoginMsgServiceImpl implements MsgSendService { throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户ID未找到" + msg.getCUserId()); } - userService.actionAfterLogin(user); + userService.actionAfterLogin(user, msg.getFindByUnionId()); } } diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendMpMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendMpMsgServiceImpl.java index 1f2f13c73..f90780729 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendMpMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendMpMsgServiceImpl.java @@ -56,7 +56,8 @@ public class SendMpMsgServiceImpl implements MsgSendService { } if (msg == null) { logger.error("找不到模板Id"); - throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); + //throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); + return; } JSONObject customParam = JSON.parseObject(msg.getCustomParam()); diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java index 862edfb5e..ab5da27aa 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java @@ -66,7 +66,8 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { } if (msg == null) { logger.error("找不到模板Id"); - throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); + // throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); + return; } JSONObject customParam = JSON.parseObject(msg.getCustomParam()); diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendWeappUniformMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendWeappUniformMsgServiceImpl.java index a7f228ff9..db5341fe9 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendWeappUniformMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendWeappUniformMsgServiceImpl.java @@ -57,7 +57,8 @@ public class SendWeappUniformMsgServiceImpl implements MsgSendService { } if (msg == null) { logger.error("找不到模板Id"); - throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); + //throw new MallinkException(ErrorCode.TEMPLATE_NOT_FOUND); + return; } JSONObject customParam = JSON.parseObject(msg.getCustomParam()); String url = customParam.getString("url"); diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index 2c3516f7a..d2888f257 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -19,11 +19,12 @@ + `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, - `create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time` + `create_date`,`update_date`,`tenant_id`,`name`,`nick_name`,`credit`,`active_time`,`act_record` ,(select level from wx_level_config where poins >= points and tenant_id=#{tenantId} order by points desc limit 1 ) level @@ -82,6 +83,10 @@ and `update_date` = #{updateDate} + + and `act_record` = #{actRecord} + + and `name` like concat('%', #{name},'%') @@ -112,7 +117,7 @@ c.`id`,c.`phone`,cb.`birthdate`,cb.`education`,cb.`sex`,cb.`email`,cb.`address`,cb.`poins`,cb.`tag_id`, - cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name + cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name,`cb.act_record` @@ -264,7 +269,7 @@ cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`, cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`, - cut.`tags`,cu.`credit`,cu.`active_time` + cut.`tags`,cu.`credit`,cu.`active_time`,cu.`act_record` @@ -318,6 +323,10 @@ and cu.`update_date` = #{updateDate} + + and cu.`act_record` = #{actRecord} + + and `name` like concat('%', #{name},'%') @@ -450,5 +459,10 @@ and cubi.tenant_id =#{tenantId} + + + UPDATE wx_c_user_basic_info set act_record = act_record +1 where id = #{id} + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml index a95022773..a9dc2c67a 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml @@ -110,6 +110,11 @@ order by create_time_md desc + + update wx_coupon_action_log + set create_time_md = DATE_FORMAT(create_time,'%m/%d') where tenant_id = #{tenantId}; + + @@ -443,13 +451,37 @@ AND co.create_date < #{endDate,jdbcType=TIMESTAMP} + + AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP} + + + + AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP} + + and co.id = #{id} and c.id = #{couponId} - + + and c.business = #{business} + + + and co.coupon_id in( + select cm.product_id from wx_merchant_shop ms left join wx_merchant m on ms.merchant_id=m.id + left join wx_shop s on ms.shop_id=s.id + left join wx_coupon_merchant cm on ms.merchant_id=cm.merchant_id + where ms.is_del=0 and s.building=#{building} + + and ms.tenant_id=#{tenantId} + + + and s.floor=#{floor} + + ) + order by ${sortColumns} order by id desc diff --git a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml index 14d67601d..ee84e6c08 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantMapper.xml @@ -234,5 +234,13 @@ select * from wx_merchant where qr_code is null; - + diff --git a/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml index f907f14a0..6e02cd58f 100644 --- a/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMsgRecordMapper.xml @@ -63,9 +63,11 @@ update wx_msg_record set updatetime = now() ,msg_status = #{msgStatus} ,status_message = #{statusMessage} - - and uuid = #{uuid} - + where id in( + select t.id from ( + select id from wx_msg_record where uuid = #{uuid} + ) t + ) - update wx_topic set status = 3 where now() >= end_time and tenant_id = #{tenantId} + update wx_topic set status = 3 where id in( + select t.id from ( + select id from wx_topic where status !=3 and now() >= end_time and tenant_id = #{tenantId} + ) t + ) - - update wx_coupon_channel set status = 1 where target_ad = 8 and sub_target_id in( + update wx_coupon_channel set status = 1 where status = 0 and target_ad = 8 and sub_target_id in( select id from wx_topic where status in(2,3) and tenant_id = #{tenantId} ) -