develop # Conflicts: # mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java # mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgRecordController.java # mallinkAdmin/src/main/java/com/iformall/controller/sys/WxBusinessController.java # mallinkService/src/main/java/com/iformall/mapper/WxCouponActionLogMapper.java # mallinkService/src/main/java/com/iformall/service/impl/MarkingDataReportServiceImpl.java # mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml # mallinkService/src/main/resources/mapper/WxCouponMapper.xmlrelease_toaliyun_real
| @@ -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<String, String> 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<String,String> 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); | |||
| } | |||
| } | |||
| }); | |||
| } | |||
| @@ -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(); | |||
| @@ -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<String,String> 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; | |||
| @@ -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<String,String> 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<WxCouponChannelAddVo> list = (List<WxCouponChannelAddVo>)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<String,String> 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查询接口") | |||
| @@ -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<WxCouponStatisVo> pages = wxCouponService.findPressData(wxCoupon,pageNum,pageSize); | |||
| List<Long> ids = new ArrayList<>(); | |||
| for(WxCouponStatisVo vo: pages.getList()) { | |||
| ids.add(vo.getId()); | |||
| } | |||
| return new ResultData(pages); | |||
| } | |||
| } | |||
| @@ -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); | |||
| } | |||
| } | |||
| @@ -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<WxMsgRecord> recordList = wxMsgRecordService.findList(msgRecord); | |||
| for (WxMsgRecord wxMsgRecord:recordList) { | |||
| @@ -14,7 +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.*; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxBusiness") | |||
| @@ -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 | |||
| @@ -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 | |||
| @@ -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 | |||
| @@ -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 | |||
| @@ -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`; | |||
| @@ -0,0 +1,2 @@ | |||
| ALTER TABLE `wx_coupon` | |||
| CHANGE COLUMN `condition` `conditions` JSON NULL DEFAULT NULL ; | |||
| @@ -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撤回'; | |||
| @@ -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; | |||
| @@ -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()) { | |||
| @@ -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); | |||
| } | |||
| @@ -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, "此用户发此券到达疲劳度限制"), | |||
| @@ -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<String, Object> flowParams; | |||
| } | |||
| @@ -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") | |||
| @@ -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; | |||
| @@ -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<String, Object> flowParams; | |||
| @io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel") | |||
| private Integer isDel; | |||
| @@ -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; | |||
| } | |||
| @@ -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; | |||
| @@ -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<WxMerchantVo> 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; | |||
| } | |||
| @@ -61,6 +61,8 @@ public enum EnumChart { | |||
| INDEX_SALE_DATA(52, "营销数据"), | |||
| RENT_RATE_HISTORY(53, "商铺出租率走势"), | |||
| BUSINESS(54,"业态分析"), | |||
| ; | |||
| public static EnumChart getEnum(Integer code) { | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -38,5 +38,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| long findGrowUserCount(WxCUserBasicInfoDto dto); | |||
| long findImportUserCount(WxCUserBasicInfoDto dto); | |||
| void incActRecordById(Long id); | |||
| } | |||
| @@ -15,6 +15,8 @@ public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog, | |||
| List<MarkingSceneDataReportVo> sceneDataMap(HashMap<String,Object> params); // will be deleted | |||
| void updateCreateTimeMd(HashMap<String,Object> params); | |||
| List<MarkingSceneDataReportTVo> getSceneDataMap(HashMap<String,Object> params); | |||
| List<MarkingSceneDataReportVo> sceneDataMapJoinCouponOrder(HashMap<String,Object> params); | |||
| @@ -10,7 +10,15 @@ import com.iformall.domain.po.WxCoupon; | |||
| public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| List<WxCouponStatisVo> findPressData(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> 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<WxCouponStatisVo> findCouponData(WxCoupon wxCoupon); | |||
| List<WxCouponStatisVo> findCountData(WxCoupon wxCoupon); | |||
| List<WxCoupon> findList(WxCoupon wxCoupon); | |||
| @@ -21,6 +29,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| 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(); | |||
| @@ -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<WxMerchant, Long> { | |||
| @@ -16,4 +17,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||
| WxMerchant queryMerchantByMerchantIdOfSharingReceiver(WxMerchant wxMerchant); | |||
| List<WxMerchant> findQrcodeEmptyList(); | |||
| List<Map<String,Object>> findBusByFloorId(Map<String, Object> params); | |||
| } | |||
| @@ -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); | |||
| /** | |||
| * 积分 | |||
| @@ -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); | |||
| } | |||
| @@ -61,7 +61,12 @@ public interface WxCouponService { | |||
| * @param record | |||
| */ | |||
| ResultData saveOrUpdate(WxCoupon record); | |||
| /** | |||
| * 更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void update(WxCoupon record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| @@ -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<MarkingSceneDataReportTVo> sceneList = wxCouponActionLogMapper.getSceneDataMap(params); | |||
| //停车发券被核销数 | |||
| @@ -207,7 +207,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||
| MarkingSceneDataReportVo msdVo = new MarkingSceneDataReportVo(); | |||
| msdVo.setXTime(tj); | |||
| Optional<MarkingSceneDataReportTVo> 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() + | |||
| @@ -52,8 +52,6 @@ public class WxBillDailyServiceImpl implements WxBillDailyService { | |||
| WxMerchantShopMapper wxMerchantShopMapper; | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDaily record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| //分页对象设置页数和条数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| //查询 | |||
| @@ -44,8 +44,6 @@ public class WxBillDepositServiceImpl implements WxBillDepositService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillDeposit record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| //updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillDepositMapper.queryBillDepositList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| @@ -44,8 +44,6 @@ public class WxBillOtherDepositServiceImpl implements WxBillOtherDepositService | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillOtherDeposit record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| //updateBillStatus(record); | |||
| //分页对象设置页数和条数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| //查询 | |||
| @@ -43,8 +43,6 @@ public class WxBillOtherServiceImpl implements WxBillOtherService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillOther record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| //分页对象设置页数和条数 | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| //查询 | |||
| @@ -43,8 +43,6 @@ public class WxBillPropertyDepositServiceImpl implements WxBillPropertyDepositSe | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillPropertyDeposit record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| //updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billDepositList = wxBillPropertyDepositMapper.queryBillDepositList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billDepositList); | |||
| @@ -43,8 +43,6 @@ public class WxBillPropertyServiceImpl implements WxBillPropertyService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillProperty record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| //updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billRentList = wxBillPropertyMapper.queryBillPropertyList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billRentList); | |||
| @@ -43,8 +43,6 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| @Override | |||
| public PageInfo<Map<String, Object>> listAsPage(WxBillRent record, Integer pageIndex, Integer pageSize) { | |||
| //更新账单状态 | |||
| updateBillStatus(record); | |||
| PageHelper.startPage(pageIndex, pageSize); | |||
| List<Map<String, Object>> billRentList = wxBillRentMapper.queryBillRentList(record); | |||
| PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(billRentList); | |||
| @@ -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<WxCUser> userList = wxCUserMapper.findList(userQ); | |||
| if(userList.size() > 1) { | |||
| for(WxCUser tempUser: userList) { | |||
| if(tempUser.getUnionId() == null) { | |||
| // 删除 无unionId的用户 | |||
| wxCUserMapper.deleteByPrimaryKey(tempUser.getId()); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| return score; | |||
| } | |||
| @@ -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<String,String> 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); | |||
| } | |||
| } | |||
| } | |||
| @@ -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<String, String> 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<String, String> paramsMap){ | |||
| Map<String,Long> resultMap = new LinkedMap(); | |||
| List<WxBusiness> businessList = wxBusinessService.findList(new WxBusiness()); | |||
| for (WxBusiness b:businessList) { | |||
| resultMap.put(b.getTitle(),0l); | |||
| } | |||
| Map<String,Object> query = new HashedMap(); | |||
| query.put("tenantId",tenantId); | |||
| query.put("id",paramsMap.get("id")); | |||
| List<Map<String,Object>> mapList = wxMerchantMapper.findBusByFloorId(query); | |||
| for (Map<String,Object> 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<String> days = DateUtils.getTjTimeList(startTime, endTime, 1==dateType.intValue()?"0":"1"); | |||
| Map<String,Long> map = getMap(days); | |||
| for (Map<String,Object> 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(); | |||
| @@ -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<String,String> map = (Map)resultDataQ.data; | |||
| if(map!=null && map.get("url") !=null) { | |||
| String url = map.get("url"); | |||
| couponChannel.setQrCode(url); | |||
| wxCouponChannelMapper.updateByPrimaryKeySelective(couponChannel); | |||
| } | |||
| return vo; | |||
| } | |||
| @@ -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<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); | |||
| list.parallelStream().forEach(c -> { | |||
| if (!c.getMerchantId().equals(0L)) { | |||
| List<WxMerchantVo> merchantVoList = c.getMerchantVoList(); | |||
| if (!merchantVoList.isEmpty()) { | |||
| StringBuffer shopNumber = new StringBuffer(); | |||
| StringBuffer building = new StringBuffer(); | |||
| WxMerchantVo wxMerchantVo = merchantVoList.get(0); | |||
| List<WxShopVo> 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); | |||
| } | |||
| @@ -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); | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxCouponStatisVo> 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); | |||
| } | |||
| } | |||
| @@ -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); | |||
| } | |||
| @@ -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()); | |||
| @@ -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<String,String> 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); | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxOrder> 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<Integer> 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<Integer> 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) { | |||
| @@ -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<String,String> 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); | |||
| } | |||
| } | |||
| } | |||
| @@ -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()); | |||
| } | |||
| } | |||
| @@ -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()); | |||
| @@ -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()); | |||
| @@ -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"); | |||
| @@ -19,11 +19,12 @@ | |||
| <result column="nick_name" jdbcType="VARCHAR" property="nickName"/> | |||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | |||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | |||
| <result column="act_record" jdbcType="INTEGER" property="actRecord"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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 | |||
| </sql> | |||
| @@ -82,6 +83,10 @@ | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != actRecord "> | |||
| and `act_record` = #{actRecord} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| @@ -112,7 +117,7 @@ | |||
| <sql id="allUserColumns"> | |||
| 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` | |||
| </sql> | |||
| <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | |||
| @@ -264,7 +269,7 @@ | |||
| <sql id="allVoColumns"> | |||
| 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` | |||
| </sql> | |||
| <sql id="dynamicVoWhereConditions"> | |||
| @@ -318,6 +323,10 @@ | |||
| and cu.`update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != actRecord "> | |||
| and cu.`act_record` = #{actRecord} | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| @@ -450,5 +459,10 @@ | |||
| and cubi.tenant_id =#{tenantId} | |||
| </if> | |||
| </select> | |||
| <update id="incActRecordById" parameterType="java.lang.Long"> | |||
| UPDATE wx_c_user_basic_info set act_record = act_record +1 where id = #{id} | |||
| </update> | |||
| </mapper> | |||
| @@ -110,6 +110,11 @@ | |||
| order by create_time_md desc | |||
| </select> | |||
| <update id="updateCreateTimeMd" parameterType="hashmap"> | |||
| update wx_coupon_action_log | |||
| set create_time_md = DATE_FORMAT(create_time,'%m/%d') where tenant_id = #{tenantId}; | |||
| </update> | |||
| <select id="sceneDataMapJoinCouponOrder" resultType="com.iformall.domain.vo.MarkingSceneDataReportVo" parameterType="hashmap"> | |||
| select DATE_FORMAT(create_date,'%m/%d') AS xTime, | |||
| COUNT(wx_coupon_order.id) as tempCount | |||
| @@ -24,7 +24,7 @@ | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| where cc.status = 0 | |||
| <if test=" null != id "> | |||
| and cc.`id` = #{id} | |||
| @@ -123,7 +123,7 @@ | |||
| <sql id="CouponChannelVoColumns"> | |||
| <include refid="allColumns" />, | |||
| c.remain_inventory,c.inventory,c.cover_img,c.title,c.sub_title,c.sale_price, | |||
| c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund, | |||
| c.use_price,c.price,c.unit,c.use_limit_quantity,c.send_type,c.support_transfer,c.press_limit_num,c.auto_refund,c.conditions, | |||
| c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.credit_price | |||
| </sql> | |||
| @@ -140,6 +140,7 @@ | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="sub_target_id" jdbcType="BIGINT" property="subTargetId" /> | |||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||
| @@ -159,6 +160,8 @@ | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate"/> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||
| <result column="qr_code" property="qrCode"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions" /> | |||
| <collection column="{productId=coupon_id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| @@ -202,7 +205,7 @@ | |||
| c.tenant_id,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.sale_price,c.use_price, | |||
| c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date, | |||
| c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status, | |||
| c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price, | |||
| c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price,c.conditions, | |||
| cc.qr_code | |||
| </sql> | |||
| @@ -244,6 +247,7 @@ | |||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||
| <result column="qr_code" property="qrCode"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions" /> | |||
| <collection column="{productId=coupon_id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| @@ -38,6 +38,11 @@ | |||
| <result column="credit_price" jdbcType="INTEGER" property="creditPrice"/> | |||
| <result column="credit_refund" jdbcType="INTEGER" property="creditRefund"/> | |||
| <result column="is_del" property="isDel"/> | |||
| <result column="put_apply_status" property="putApplyStatus"/> | |||
| <result column="stock_apply_status" property="stockApplyStatus"/> | |||
| <result column="cancle_apply_status" property="cancleApplyStatus"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions"/> | |||
| </resultMap> | |||
| <resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| @@ -90,7 +95,7 @@ | |||
| `id`,`tenant_id`,`type`,`cover_img`,`cover_picture`,`detail_picture`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_type`, | |||
| `valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`, | |||
| `remark`,`status`,`create_date`,`update_date`,`business`,`sub_business`,`support_transfer`,`subsidy_num`,`subsidy_type`, | |||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund` | |||
| `press_limit_num`, `press_limit_hours`, `auto_refund`,`credit_price`,`credit_refund`,put_apply_status,stock_apply_status,cancle_apply_status | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -465,6 +470,7 @@ | |||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||
| <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/> | |||
| <result column="conditions" jdbcType="VARCHAR" property="conditions"/> | |||
| <collection column="{productId=id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| @@ -818,7 +824,7 @@ where cpd.tenant_id=#{tenantId} | |||
| wc.tenant_id,wc.`type`,wc.`cover_img`,wc.`cover_picture`,wc.`detail_picture`,wc.`title`,wc.`sub_title`,wc.`sale_price`,wc.`use_price`,wc.`use_limit_quantity`,wc.`send_type`, | |||
| wc.`valid_type`,wc.`valid_start_date`,wc.`valid_end_date`,wc.`valid_days`,wc.`detail`,wc.`price`,wc.`unit`,wc.`remain_inventory`,wc.`inventory`, | |||
| wc.`remark`,wc.`status`,wc.`create_date`,wc.`update_date`,wc.`business`,wc.`sub_business`,wc.`support_transfer`,wc.`subsidy_num`,wc.`subsidy_type`, | |||
| wc.`press_limit_num`, wc.`press_limit_hours`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund` | |||
| wc.`press_limit_num`, wc.`press_limit_hours`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`,wc.`conditions` | |||
| ,wc.title as couponName,wc.`cover_img` as couponPic,wc.`cover_picture` as couponPicture,wc.`detail_picture` as detailPicture,wc.id as couponId from wx_coupon_channel ct left join | |||
| wx_coupon wc on wc.id = ct.coupon_id | |||
| where ct.`sub_target_id` = #{id} | |||
| @@ -360,19 +360,24 @@ | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="coupon_price" jdbcType="INTEGER" property="couponPrice" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | |||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | |||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund" /> | |||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||
| <collection column="{productId=coupon_id}" property="merchantVoList" | |||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||
| javaType="java.util.List" | |||
| @@ -382,18 +387,21 @@ | |||
| <sql id="allAdminCouponOrderListColumns"> | |||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund, | |||
| c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,c.subsidy_num, | |||
| (case when com.mc=1 then | |||
| (select m.name from wx_merchant m, wx_coupon_merchant cm | |||
| where m.id = cm.merchant_id and cm.product_id=co.coupon_id and cm.status = 0) else '[多商户通用]' end) as merchant_name | |||
| where m.id = cm.merchant_id and cm.product_id=co.coupon_id and cm.status = 0) else '[多商户通用]' end) as merchant_name, | |||
| (case when com.mc = 1 then (select m.id from wx_merchant m, | |||
| wx_coupon_merchant cm where m.id = cm.merchant_id and cm.product_id = co.coupon_id | |||
| and cm.status = 0) else 0 end) as merchant_id,(select phone from wx_c_user where id=co.c_user_id) phone | |||
| </sql> | |||
| <sql id="allAdminCouponOrderDetailColumns"> | |||
| co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund, | |||
| c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,c.auto_refund,c.business,c.subsidy_type,c.subsidy_num, | |||
| bu.name, bu.phone as bphone, | |||
| cu.phone, | |||
| m.name as merchant_name | |||
| m.name as merchant_name,m.id as merchant_id | |||
| </sql> | |||
| <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap"> | |||
| @@ -443,13 +451,37 @@ | |||
| AND co.create_date < #{endDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="verifyStartDate != null"> | |||
| AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test="verifyEndDate != null"> | |||
| AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP} | |||
| </if> | |||
| <if test=" null != id "> | |||
| and co.id = #{id} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and c.id = #{couponId} | |||
| </if> | |||
| <if test=" null != business "> | |||
| and c.business = #{business} | |||
| </if> | |||
| <if test="null!=building"> | |||
| 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} | |||
| <if test=" null != tenantId "> | |||
| and ms.tenant_id=#{tenantId} | |||
| </if> | |||
| <if test="null!=floor"> | |||
| and s.floor=#{floor} | |||
| </if> | |||
| ) | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by id desc </if> | |||
| @@ -234,5 +234,13 @@ | |||
| select * from wx_merchant where qr_code is null; | |||
| </select> | |||
| <select id="findBusByFloorId" resultType="hashmap" parameterType="hashmap"> | |||
| select count(m.business_id) count,b.id bid,b.`title` btitle from wx_merchant m left join wx_merchant_shop ms on(m.id = ms.merchant_id) | |||
| left join wx_shop s on(ms.shop_id = s.id) | |||
| left join wx_mall_floor f on(s.floor = f.id) | |||
| left join wx_business b on(m.business_id = b.id) | |||
| where f.id = #{id} | |||
| and m.tenant_id = #{tenantId} | |||
| group by m.business_id | |||
| </select> | |||
| </mapper> | |||