| @@ -2,4 +2,5 @@ package com.iformall.constant; | |||||
| public interface SwaggerConstant { | public interface SwaggerConstant { | ||||
| String V_1_0_0 = "v1.0.0"; | String V_1_0_0 = "v1.0.0"; | ||||
| String V_2_0_0 = "v2.0.0"; | |||||
| } | } | ||||
| @@ -0,0 +1,152 @@ | |||||
| package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.ApiVersion; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.constant.SwaggerConstant; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumLegionActivityStatus; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.WxLegionActivityConfigService; | |||||
| import com.iformall.service.WxLegionActivityOrderService; | |||||
| import com.iformall.service.WxLegionActivityService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author alascor | |||||
| * | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("/legion") | |||||
| @Api(tags = "军团活动相关接口") | |||||
| public class WxLegionActivityController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxLegionActivityService wxLegionActivityService; | |||||
| @Autowired | |||||
| private WxLegionActivityConfigService wxLegionActivityConfigService; | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxLegionActivity wxLegionActivity, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxLegionActivity) wxLegionActivity = new WxLegionActivity(); | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivity.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivity.setSortColumns(SortField.CreateDate_DESC); | |||||
| wxLegionActivity.setNeedCount(true); | |||||
| final PageInfo<WxLegionActivity> page = wxLegionActivityService.listAsPage(wxLegionActivity, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("新增修改接口") | |||||
| @PostMapping("saveOrUpdate") | |||||
| public ResultData saveOrUpdate(@RequestBody WxLegionActivity wxLegionActivity) { | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivity.updateTenantInfo(tenantEntity); | |||||
| if(wxLegionActivity.getLegionList() == null || wxLegionActivity.getLegionList().isEmpty()){ | |||||
| return new ResultData(Result.ERROR,"军团配置为空"); | |||||
| } | |||||
| List<Long> merchantIds = new ArrayList<>(); | |||||
| for (WxLegionActivityConfig legionConfig:wxLegionActivity.getLegionList()){ | |||||
| if(legionConfig.getMerchantList() == null || legionConfig.getMerchantList().isEmpty()){ | |||||
| continue; | |||||
| } | |||||
| for (WxLegionActivityMerchantConfig wxLegionActivityMerchantConfig : legionConfig.getMerchantList()) { | |||||
| merchantIds.add(wxLegionActivityMerchantConfig.getMerchantId()); | |||||
| } | |||||
| } | |||||
| if(!merchantIds.isEmpty() && merchantIds.stream().distinct().count() != merchantIds.size()){ | |||||
| return new ResultData(Result.ERROR,"军团商户配置重复"); | |||||
| } | |||||
| wxLegionActivityService.saveOrUpdate(wxLegionActivity); | |||||
| return new ResultData(wxLegionActivity); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("删除活动门店") | |||||
| @PostMapping("delMerchant") | |||||
| public ResultData delMerchant(@RequestBody WxLegionActivity wxLegionActivity) { | |||||
| if(wxLegionActivity.getId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动id为空"); | |||||
| } | |||||
| if(wxLegionActivity.getMerchantConfigIdList() == null || wxLegionActivity.getMerchantConfigIdList().isEmpty()){ | |||||
| return new ResultData(Result.ERROR,"删除门店为空"); | |||||
| } | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivity.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivityService.delMerchant(wxLegionActivity); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("上架") | |||||
| @PostMapping("online") | |||||
| public ResultData online(@RequestBody WxLegionActivity wxLegionActivity) { | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivity.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivity.setStatus(EnumLegionActivityStatus.ON_LINE.getCode()); | |||||
| wxLegionActivityService.updateStatus(wxLegionActivity); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("下架") | |||||
| @PostMapping("offline") | |||||
| public ResultData offline(@RequestBody WxLegionActivity wxLegionActivity) { | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivity.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivity.setStatus(EnumLegionActivityStatus.OFF_LINE.getCode()); | |||||
| wxLegionActivityService.updateStatus(wxLegionActivity); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询详情") | |||||
| @GetMapping("getInfoById") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getInfoById(Long id) { | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| WxLegionActivity activity = wxLegionActivityService.getInfoById(id, tenantInfo.getTenantId()); | |||||
| return new ResultData(activity); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询军团列表") | |||||
| @GetMapping("getLegionById") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getLegionById(Long id) { | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| List<WxLegionActivityConfig> legionConfigList = wxLegionActivityConfigService.findLegionList(id,tenantInfo.getTenantId()); | |||||
| return new ResultData(legionConfigList); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,208 @@ | |||||
| package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.ApiVersion; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.constant.SwaggerConstant; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.WxLegionActivityOrder; | |||||
| import com.iformall.domain.po.WxOfflineActivityRecord; | |||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.LegionActivityMerchantStatistics; | |||||
| import com.iformall.domain.vo.LegionActivitySellOrder; | |||||
| import com.iformall.enums.EnumLegionActivityOrderStatus; | |||||
| import com.iformall.enums.EnumOfflineActivityRecordStatus; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.WxLegionActivityOrderService; | |||||
| import com.iformall.service.WxOfflineActivityRecordService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import jodd.util.StringUtil; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author alascor | |||||
| * | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("/legionOrder") | |||||
| @Api(tags = "军团活动订单相关接口") | |||||
| public class WxLegionActivityOrderController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxLegionActivityOrderService wxLegionActivityOrderService; | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxLegionActivityOrder) wxLegionActivityOrder = new WxLegionActivityOrder(); | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityOrder.setSortColumns(SortField.CreateDate_DESC); | |||||
| final PageInfo<WxLegionActivityOrder> page = wxLegionActivityOrderService.listAsPage(wxLegionActivityOrder, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("导出") | |||||
| @GetMapping("/export") | |||||
| public void export(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder, HttpServletRequest request, HttpServletResponse response) { | |||||
| if (null == wxLegionActivityOrder) wxLegionActivityOrder = new WxLegionActivityOrder(); | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityOrder.setSortColumns(SortField.CreateDate_DESC); | |||||
| wxLegionActivityOrderService.exportData(request,response,wxLegionActivityOrder); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("审核通过") | |||||
| @PostMapping("audiPass") | |||||
| public ResultData audiPass(@RequestBody WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder == null){ | |||||
| return new ResultData(Result.ERROR,"id 不能为空"); | |||||
| } | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivityOrder.setAuditStatus(EnumLegionActivityOrderStatus.AUDI_SUCCESS.getCode()); | |||||
| wxLegionActivityOrderService.auditRecord(wxLegionActivityOrder,getUserId()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("审核驳回") | |||||
| @PostMapping("audtFail") | |||||
| public ResultData audtFail(@RequestBody WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder == null){ | |||||
| return new ResultData(Result.ERROR,"id 不能为空"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityOrder.getAuditRemark())){ | |||||
| return new ResultData(Result.ERROR,"驳回意见不能为空"); | |||||
| } | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivityOrder.setAuditStatus(EnumLegionActivityOrderStatus.AUDT_FAIL.getCode()); | |||||
| wxLegionActivityOrderService.auditRecord(wxLegionActivityOrder,getUserId()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("失效") | |||||
| @PostMapping("invalid") | |||||
| public ResultData invalid(@RequestBody WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder == null){ | |||||
| return new ResultData(Result.ERROR,"id 不能为空"); | |||||
| } | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivityOrder.setAuditStatus(EnumLegionActivityOrderStatus.INVALID.getCode()); | |||||
| wxLegionActivityOrderService.auditRecord(wxLegionActivityOrder,getUserId()); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询详情") | |||||
| @GetMapping("getInfoById") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getInfoById(Long id) { | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| WxLegionActivityOrder record = wxLegionActivityOrderService.getInfoById(id, tenantInfo.getTenantId()); | |||||
| return new ResultData(record); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询活动数据(军团?)") | |||||
| @GetMapping("getActivityData") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getActivityData(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| Map<String,Object> activityData = wxLegionActivityOrderService.getActivityData(wxLegionActivityOrder); | |||||
| return new ResultData(activityData); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询活动数据(门店)") | |||||
| @GetMapping("getActivityMerchantData") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getActivityMerchantData(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| List<LegionActivityMerchantStatistics> activityMerchantData = wxLegionActivityOrderService.getActivityMerchantData(wxLegionActivityOrder); | |||||
| return new ResultData(activityMerchantData); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("导出活动数据(门店)") | |||||
| @GetMapping("/exportActivityMerchantData") | |||||
| public void exportActivityMerchantDate(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder, HttpServletRequest request, HttpServletResponse response) { | |||||
| if (null == wxLegionActivityOrder) wxLegionActivityOrder = new WxLegionActivityOrder(); | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityOrderService.exportActivityMerchantData(request,response,wxLegionActivityOrder); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询活动数据(带单数据)") | |||||
| @GetMapping("getActivitySellOrder") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getActivitySellOrder(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| List<LegionActivitySellOrder> activityMerchantDate = wxLegionActivityOrderService.getActivitySellOrder(wxLegionActivityOrder); | |||||
| return new ResultData(activityMerchantDate); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("导出活动数据(带单数据)") | |||||
| @GetMapping("/exportActivitySellOrder") | |||||
| public void exportActivitySellOrder(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder, HttpServletRequest request, HttpServletResponse response) { | |||||
| if (null == wxLegionActivityOrder) wxLegionActivityOrder = new WxLegionActivityOrder(); | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityOrderService.exportActivitySellOrder(request,response,wxLegionActivityOrder); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.ApiVersion; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.constant.SwaggerConstant; | |||||
| import com.iformall.domain.po.WxLegionActivity; | |||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumLegionActivityStatus; | |||||
| import com.iformall.service.WxLegionActivityService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import jodd.util.StringUtil; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author alascor | |||||
| * | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("/api/legion") | |||||
| @Api(tags = "军团活动相关接口") | |||||
| public class WxLegionActivityController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxLegionActivityService wxLegionActivityService; | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxLegionActivity wxLegionActivity, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxLegionActivity) wxLegionActivity = new WxLegionActivity(); | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivity.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivity.setStatusList(EnumLegionActivityStatus.getLine()); | |||||
| wxLegionActivity.setSortColumns(SortField.CreateDate_DESC); | |||||
| wxLegionActivity.setNeedCount(false); | |||||
| wxLegionActivity.setMerchantId(getLoginBUser().getMerchantId()); | |||||
| final PageInfo<WxLegionActivity> page = wxLegionActivityService.listAsPage(wxLegionActivity,pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,111 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.ApiVersion; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.constant.SwaggerConstant; | |||||
| import com.iformall.domain.po.WxLegionActivityOrder; | |||||
| import com.iformall.domain.po.WxOfflineActivityRecord; | |||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.service.WxLegionActivityOrderService; | |||||
| import com.iformall.service.WxOfflineActivityRecordService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import jodd.util.StringUtil; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author alascor | |||||
| * | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("/api/legionOrder") | |||||
| @Api(tags = "军团活动订单相关接口") | |||||
| public class WxLegionActivityOrderController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxLegionActivityOrderService wxLegionActivityOrderService; | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxLegionActivityOrder) wxLegionActivityOrder = new WxLegionActivityOrder(); | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityOrder.setSortColumns(SortField.CreateDate_DESC); | |||||
| wxLegionActivityOrder.setMerchantId(getLoginBUser().getMerchantId()); | |||||
| final PageInfo<WxLegionActivityOrder> page = wxLegionActivityOrderService.listAsPage(wxLegionActivityOrder, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("新增修改接口") | |||||
| @PostMapping("saveOrUpdate") | |||||
| public ResultData saveOrUpdate(@RequestBody WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityOrder.getOrderNo())){ | |||||
| return new ResultData(Result.ERROR,"订单号不能为空"); | |||||
| } | |||||
| if (null == wxLegionActivityOrder.getOrderMoney() ) { | |||||
| return new ResultData(Result.ERROR,"订单金额不能为空"); | |||||
| } | |||||
| if(wxLegionActivityOrder.getCusId() == null){ | |||||
| return new ResultData(Result.ERROR,"未查询到用户,请先进行VIP卡绑定"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityOrder.getCusPhone())){ | |||||
| return new ResultData(Result.ERROR,"客户手机号不能为空"); | |||||
| } | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivityOrder.setCreateBy(getMerchantBUserId()); | |||||
| wxLegionActivityOrder.setMerchantId(getLoginBUser().getMerchantId()); | |||||
| wxLegionActivityOrderService.saveOrUpdate(wxLegionActivityOrder); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询当前信息详情") | |||||
| @GetMapping("getInfoById") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getInfoById(Long id) { | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| WxLegionActivityOrder activity = wxLegionActivityOrderService.getInfoById(id, tenantInfo.getTenantId()); | |||||
| return new ResultData(activity); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询当前信息统计") | |||||
| @GetMapping("statistics") | |||||
| public ResultData statisticsCount(@ModelAttribute WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if(wxLegionActivityOrder.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityOrder.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityOrder.setMerchantId(getLoginBUser().getMerchantId()); | |||||
| Map<String,Integer> statisticsMap = wxLegionActivityOrderService.getStatistics(wxLegionActivityOrder); | |||||
| return new ResultData(statisticsMap); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,113 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.ApiVersion; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.constant.SwaggerConstant; | |||||
| import com.iformall.domain.po.WxLegionActivityUser; | |||||
| import com.iformall.domain.po.WxOfflineActivityRecord; | |||||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumLegionActivityUserStatus; | |||||
| import com.iformall.service.WxLegionActivityUserService; | |||||
| import com.iformall.service.WxOfflineActivityRecordService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import jodd.util.StringUtil; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author alascor | |||||
| * | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("/api/legionUser") | |||||
| @Api(tags = "军团活动用户相关接口") | |||||
| public class WxLegionActivityUserController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxLegionActivityUserService wxLegionActivityUserService; | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxLegionActivityUser wxLegionActivityUser, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxLegionActivityUser) wxLegionActivityUser = new WxLegionActivityUser(); | |||||
| if(wxLegionActivityUser.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityUser.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityUser.setSortColumns(SortField.CreateDate_DESC); | |||||
| wxLegionActivityUser.setMerchantId(getLoginBUser().getMerchantId()); | |||||
| final PageInfo<WxLegionActivityUser> page = wxLegionActivityUserService.listAsPage(wxLegionActivityUser, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("新增修改接口") | |||||
| @PostMapping("saveOrUpdate") | |||||
| public ResultData saveOrUpdate(@RequestBody WxLegionActivityUser wxLegionActivityUser) { | |||||
| if(wxLegionActivityUser.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityUser.getPhone())){ | |||||
| return new ResultData(Result.ERROR,"客户手机号不能为空"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityUser.getVipNum())){ | |||||
| return new ResultData(Result.ERROR,"vip卡号不能为空"); | |||||
| } | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxLegionActivityUser.updateTenantInfo(tenantEntity); | |||||
| wxLegionActivityUser.setCreateBy(getMerchantBUserId()); | |||||
| wxLegionActivityUser.setMerchantId(getLoginBUser().getMerchantId()); | |||||
| wxLegionActivityUserService.saveOrUpdate(wxLegionActivityUser); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("查询当前信息详情") | |||||
| @GetMapping("getInfoById") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getInfoById(Long id) { | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| WxLegionActivityUser user = wxLegionActivityUserService.getById(id, tenantInfo.getTenantId()); | |||||
| return new ResultData(user); | |||||
| } | |||||
| @ApiVersion(group = SwaggerConstant.V_2_0_0) | |||||
| @ApiOperation("通过手机号查询") | |||||
| @GetMapping("getByPhone") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "主键id", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData getInfoById(@ModelAttribute WxLegionActivityUser wxLegionActivityUser) { | |||||
| if(wxLegionActivityUser.getActivityId() == null){ | |||||
| return new ResultData(Result.ERROR,"活动ID不能为空"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityUser.getPhone())){ | |||||
| return new ResultData(Result.ERROR,"客户手机号不能为空"); | |||||
| } | |||||
| TenantEntity tenantInfo = getTenantInfo(); | |||||
| wxLegionActivityUser.updateTenantInfo(tenantInfo); | |||||
| wxLegionActivityUser.setStatus(EnumLegionActivityUserStatus.VALID.getCode()); | |||||
| WxLegionActivityUser user = wxLegionActivityUserService.selectOne(wxLegionActivityUser); | |||||
| if(user == null){ | |||||
| return new ResultData(Result.ERROR,"未查询到用户,请先绑定VIP"); | |||||
| } | |||||
| return new ResultData(user); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,162 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.IdType; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableId; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| /** | |||||
| * 军团活动 | |||||
| * @TableName wx_legion_activity | |||||
| */ | |||||
| @TableName(value ="wx_legion_activity") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxLegionActivity extends TenantEntity { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| @TableId(value = "id") | |||||
| private Long id; | |||||
| /** | |||||
| * 活动名称 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动名称",name="name") | |||||
| @TableField(value = "name") | |||||
| private String name; | |||||
| /** | |||||
| * 开始时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动开始时间",name="startTime") | |||||
| @TableField(value = "start_time") | |||||
| private Date startTime; | |||||
| /** | |||||
| * 结束时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动结束时间",name="endTime") | |||||
| @TableField(value = "end_time") | |||||
| private Date endTime; | |||||
| /** | |||||
| * 售卡积分 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="售卡积分",name="sellingCard") | |||||
| @TableField(value = "selling_card") | |||||
| private Integer sellingCard; | |||||
| /** | |||||
| * 签单积分 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="签单积分",name="signOrder") | |||||
| @TableField(value = "sign_order") | |||||
| private Integer signOrder; | |||||
| /** | |||||
| * 外部军团带单 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="外部军团带单",name="difLegionOrder") | |||||
| @TableField(value = "dif_legion_order") | |||||
| private Integer difLegionOrder; | |||||
| /** | |||||
| * 内部军团不同联盟带单 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="内部军团不同联盟带单",name="difUnionOrder") | |||||
| @TableField(value = "dif_union_order") | |||||
| private Integer difUnionOrder; | |||||
| /** | |||||
| * 内部军团相同联盟带单 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="内部军团相同联盟带单",name="eqUnionOrder") | |||||
| @TableField(value = "eq_union_order") | |||||
| private Integer eqUnionOrder; | |||||
| /** | |||||
| * 内部军团无联盟带单 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="内部军团无联盟带单",name="notUnionOrder") | |||||
| @TableField(value = "not_union_order") | |||||
| private Integer notUnionOrder; | |||||
| /** | |||||
| * 状态 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态(0:草稿 1:已上架 2:已下架 3:已过期 4:未开始)",name="status") | |||||
| @TableField(value = "status") | |||||
| private Integer status; | |||||
| /** | |||||
| * 创建时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| @TableField(value = "create_date") | |||||
| private Date createDate; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateDate") | |||||
| @TableField(value = "update_date") | |||||
| private Date updateDate; | |||||
| @TableField(exist = false) | |||||
| private Date begin; | |||||
| @TableField(exist = false) | |||||
| private Date end; | |||||
| /** | |||||
| * 是否过期 | |||||
| */ | |||||
| @TableField(exist = false) | |||||
| private Integer validStatus; | |||||
| /** | |||||
| * 是否开始 | |||||
| */ | |||||
| @TableField(exist = false) | |||||
| private Integer startStatus; | |||||
| @TableField(exist = false) | |||||
| private List<Integer> statusList; | |||||
| /** | |||||
| * 军团列表 | |||||
| */ | |||||
| @TableField(exist = false) | |||||
| private List<WxLegionActivityConfig> legionList; | |||||
| @TableField(exist = false) | |||||
| private Integer legionCount; | |||||
| @TableField(exist = false) | |||||
| private Integer merchantCount; | |||||
| @TableField(exist = false) | |||||
| private List<Long> merchantConfigIdList; | |||||
| @TableField(exist = false) | |||||
| private Map<String,Object> activityData; | |||||
| @TableField(exist = false) | |||||
| private boolean needCount; | |||||
| @TableField(exist = false) | |||||
| private Long merchantId; | |||||
| @TableField(exist = false) | |||||
| private String legionName; | |||||
| @TableField(exist = false) | |||||
| private String unionName; | |||||
| } | |||||
| @@ -0,0 +1,79 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.IdType; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableId; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| /** | |||||
| * 军团活动军团配置 | |||||
| * @TableName wx_legion_activity_config | |||||
| */ | |||||
| @TableName(value ="wx_legion_activity_config") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxLegionActivityConfig extends TenantEntity { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| @TableId(value = "id") | |||||
| private Long id; | |||||
| /** | |||||
| * 活动id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动id",name="activityId") | |||||
| @TableField(value = "activity_id") | |||||
| private Long activityId; | |||||
| @TableField(exist = false) | |||||
| private List<Long> activityIdList; | |||||
| /** | |||||
| * 上级ID | |||||
| */ | |||||
| @TableField(value = "parent_id") | |||||
| private Long parentId; | |||||
| /** | |||||
| * 军团/联盟名称 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="军团/联盟名称",name="name") | |||||
| @TableField(value = "name") | |||||
| private String name; | |||||
| /** | |||||
| * 创建时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| @TableField(value = "create_date") | |||||
| private Date createDate; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| @TableField(value = "update_date") | |||||
| private Date updateDate; | |||||
| /** | |||||
| * 联盟列表 | |||||
| */ | |||||
| @TableField(exist = false) | |||||
| private List<WxLegionActivityConfig> unionList; | |||||
| /** | |||||
| * 门店列表 | |||||
| */ | |||||
| @TableField(exist = false) | |||||
| private List<WxLegionActivityMerchantConfig> merchantList; | |||||
| } | |||||
| @@ -0,0 +1,80 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.IdType; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableId; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| /** | |||||
| * 军团活动商户配置 | |||||
| * @TableName wx_legion_activity_merchant_config | |||||
| */ | |||||
| @TableName(value ="wx_legion_activity_merchant_config") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxLegionActivityMerchantConfig extends TenantEntity { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| @TableId(value = "id") | |||||
| private Long id; | |||||
| /** | |||||
| * 活动id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动id",name="activityId") | |||||
| @TableField(value = "activity_id") | |||||
| private Long activityId; | |||||
| @TableField(exist = false) | |||||
| private List<Long> activityIdList; | |||||
| /** | |||||
| * 军团id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="军团id",name="legionId") | |||||
| @TableField(value = "legion_id") | |||||
| private Long legionId; | |||||
| /** | |||||
| * 商户Id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户Id",name="merchantId") | |||||
| @TableField(value = "merchant_id") | |||||
| private Long merchantId; | |||||
| @TableField(exist = false) | |||||
| private String merchantName; | |||||
| @TableField(exist = false) | |||||
| private String merchantPhone; | |||||
| /** | |||||
| * 联盟ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="联盟ID",name="unionId") | |||||
| @TableField(value = "union_id") | |||||
| private Long unionId; | |||||
| /** | |||||
| * 创建时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| @TableField(value = "create_date") | |||||
| private Date createDate; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| @TableField(value = "update_date") | |||||
| private Date updateDate; | |||||
| } | |||||
| @@ -0,0 +1,206 @@ | |||||
| package com.iformall.domain.po; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.IdType; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableId; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import java.io.Serializable; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| /** | |||||
| * 军团活动订单 | |||||
| * @TableName wx_legion_activity_order | |||||
| */ | |||||
| @TableName(value ="wx_legion_activity_order") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxLegionActivityOrder extends TenantEntity { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| @TableId(value = "id") | |||||
| private Long id; | |||||
| /** | |||||
| * 活动Id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动id",name="activityId") | |||||
| @TableField(value = "activity_id") | |||||
| private Long activityId; | |||||
| /** | |||||
| * 订单号 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="订单号",name="orderNo") | |||||
| @Excel(name = "订单号", width = 20, orderNum = "1") | |||||
| @TableField(value = "order_no") | |||||
| private String orderNo; | |||||
| /** | |||||
| * 订单金额 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="已收定金",name="orderMoney") | |||||
| @Excel(name = "已收定金", width = 20, orderNum = "10") | |||||
| @TableField(value = "order_money") | |||||
| private BigDecimal orderMoney; | |||||
| /** | |||||
| * 客户Id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="客户Id",name="cusId") | |||||
| @TableField(value = "cus_id") | |||||
| private Long cusId; | |||||
| @TableField(exist = false) | |||||
| private List<Long> cusIdList; | |||||
| @io.swagger.annotations.ApiModelProperty(value="客户手机号",name="cusPhone") | |||||
| @Excel(name = "客户手机号", width = 20, orderNum = "5") | |||||
| @TableField(exist = false) | |||||
| private String cusPhone; | |||||
| @io.swagger.annotations.ApiModelProperty(value="VIP卡号",name="cusVipNum") | |||||
| @Excel(name = "VIP卡号", width = 20, orderNum = "3") | |||||
| @TableField(exist = false) | |||||
| private String cusVipNum; | |||||
| /** | |||||
| * 客户姓名 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="客户姓名",name="cusName") | |||||
| @Excel(name = "客户姓名", width = 20, orderNum = "4") | |||||
| @TableField(value = "cus_name") | |||||
| private String cusName; | |||||
| /** | |||||
| * 客户地址 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="客户地址",name="cusAddress") | |||||
| @Excel(name = "客户地址", width = 20, orderNum = "6") | |||||
| @TableField(value = "cus_address") | |||||
| private String cusAddress; | |||||
| /** | |||||
| * 商户编号 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户编号",name="merchantId") | |||||
| @TableField(value = "merchant_id") | |||||
| private Long merchantId; | |||||
| @Excel(name = "商户名称", width = 20, orderNum = "7") | |||||
| @TableField(exist = false) | |||||
| private String merchantName; | |||||
| @TableField(exist = false) | |||||
| private List<Long> merchantIdList; | |||||
| /** | |||||
| * 军团ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="军团ID",name="legionId") | |||||
| @TableField(value = "legion_id") | |||||
| private Long legionId; | |||||
| @Excel(name = "所属军团", width = 20, orderNum = "8") | |||||
| @TableField(exist = false) | |||||
| private String legionName; | |||||
| @TableField(exist = false) | |||||
| private Integer legionType; | |||||
| /** | |||||
| * 联盟id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="联盟id",name="unionId") | |||||
| @TableField(value = "union_id") | |||||
| private Long unionId; | |||||
| // /** | |||||
| // * 卡属派系 | |||||
| // */ | |||||
| // @Excel(name = "所属派系", width = 20, orderNum = "9", replace = {"原联盟_1", "非联盟_2"}) | |||||
| // @TableField(exist = false) | |||||
| // private Integer unionType; | |||||
| /** | |||||
| * 带单类型 | |||||
| * SIGN_ORDER(0, "签单"), | |||||
| * DIF_LEGION(1, "外部军团带单"), | |||||
| * DIF_UNION(2, "内部军团不同联盟带单"), | |||||
| * EQ_UNION(3, "内部军团相同联盟带单"), | |||||
| * NOT_UNION(4, "内部军团无联盟带单"),; | |||||
| * 0:签单, 1:外部军团带单1, 2:内部军团不同联盟带单, 3:内部军团相同联盟带单, 4:内部军团无联盟带单 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="带单类型 0:签单, 1:外部军团带单1, 2:内部军团不同联盟带单, 3:内部军团相同联盟带单, 4:内部军团无联盟带单",name="orderType") | |||||
| @Excel(name = "带单类型", width = 20, orderNum = "9", replace = {"签单_0", "外部军团带单_1", "内部军团不同联盟带单_2", "内部军团相同联盟带单_3", "内部军团无联盟带单_4"}) | |||||
| @TableField(value = "order_type") | |||||
| private Integer orderType; | |||||
| @TableField(exist = false) | |||||
| private List<Integer> orderTypeList; | |||||
| /** | |||||
| * | |||||
| */ | |||||
| @TableField(value = "create_by") | |||||
| private Long createBy; | |||||
| /** | |||||
| * 创建时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| @Excel(name = "提交时间", format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "2") | |||||
| @TableField(value = "create_date") | |||||
| private Date createDate; | |||||
| @TableField(exist = false) | |||||
| private Date createDateBegin; | |||||
| @TableField(exist = false) | |||||
| private Date createDateEnd; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| @TableField(value = "update_date") | |||||
| private Date updateDate; | |||||
| /** | |||||
| * 审批意见 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="审批意见",name="auditRemark") | |||||
| @TableField(value = "audit_remark") | |||||
| private String auditRemark; | |||||
| /** | |||||
| * 审批状态 | |||||
| * 0:审核中, 1:已审批, 2:已驳回, 3:已失效 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="审批状态 0:审核中, 1:已审批, 2:已驳回, 3:已失效",name="auditStatus") | |||||
| @Excel(name = "审核状态", width = 20, orderNum = "11", replace = {"审核中_0", "已审批_1", "已驳回_2", "已失效_3"}) | |||||
| @TableField(value = "audit_status") | |||||
| private Integer auditStatus; | |||||
| /** | |||||
| * 审核人 | |||||
| */ | |||||
| @TableField(value = "audit_by") | |||||
| private Long auditBy; | |||||
| /** | |||||
| * 审核时间 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="审核时间",name="auditTime") | |||||
| @TableField(value = "audit_time") | |||||
| private Date auditTime; | |||||
| @TableField(exist = false) | |||||
| private Date auditTimeBegin; | |||||
| @TableField(exist = false) | |||||
| private Date auditTimeEnd; | |||||
| } | |||||
| @@ -0,0 +1,116 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.IdType; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableId; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| /** | |||||
| * 军团活动用户 | |||||
| * @TableName wx_legion_activity_user | |||||
| */ | |||||
| @TableName(value ="wx_legion_activity_user") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxLegionActivityUser extends TenantEntity { | |||||
| /** | |||||
| * 主键ID | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| @TableId(value = "id") | |||||
| private Long id; | |||||
| /** | |||||
| * 活动id | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="活动id",name="activityId") | |||||
| @TableField(value = "activity_id") | |||||
| private Long activityId; | |||||
| /** | |||||
| * 用户手机号 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户手机号",name="phone") | |||||
| @TableField(value = "phone") | |||||
| private String phone; | |||||
| /** | |||||
| * 用户姓名 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="phone") | |||||
| @TableField(value = "name") | |||||
| private String name; | |||||
| /** | |||||
| * 用户地址 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户地址",name="address") | |||||
| @TableField(value = "address") | |||||
| private String address; | |||||
| /** | |||||
| * 会员卡号 | |||||
| */ | |||||
| @io.swagger.annotations.ApiModelProperty(value="会员卡号",name="vipNum") | |||||
| @TableField(value = "vip_num") | |||||
| private String vipNum; | |||||
| /** | |||||
| * 商户id | |||||
| */ | |||||
| @TableField(value = "merchant_id") | |||||
| private Long merchantId; | |||||
| @TableField(exist = false) | |||||
| private List<Long> merchantIdList; | |||||
| /** | |||||
| * 所属军团 | |||||
| */ | |||||
| @TableField(value = "legion_id") | |||||
| private Long legionId; | |||||
| /** | |||||
| * 所属联盟 | |||||
| */ | |||||
| @TableField(value = "union_id") | |||||
| private Long unionId; | |||||
| /** | |||||
| * 状态 | |||||
| */ | |||||
| @TableField(value = "status") | |||||
| private Integer status; | |||||
| /** | |||||
| * | |||||
| */ | |||||
| @TableField(value = "create_by") | |||||
| private Long createBy; | |||||
| /** | |||||
| * 创建时间 | |||||
| */ | |||||
| @TableField(value = "create_date") | |||||
| private Date createDate; | |||||
| @TableField(exist = false) | |||||
| private Date createDateBegin; | |||||
| @TableField(exist = false) | |||||
| private Date createDateEnd; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| @TableField(value = "update_date") | |||||
| private Date updateDate; | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| public class LegionActivityCount implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long activityId; | |||||
| private Integer count; | |||||
| } | |||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| public class LegionActivityMerchantStatistics implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long merchantId; | |||||
| @Excel(name="商铺名称",width = 20,orderNum = "1") | |||||
| private String merchantName; | |||||
| @Excel(name="商铺号",width = 20,orderNum = "2") | |||||
| private String shopNumber; | |||||
| @Excel(name="售卡数量",width = 20,orderNum = "3") | |||||
| private Integer userCount; | |||||
| @Excel(name="签单数量",width = 20,orderNum = "4") | |||||
| private Integer orderCount; | |||||
| // @Excel(name="带单数量",width = 20,orderNum = "5") | |||||
| private Integer sellOrderCount; | |||||
| @Excel(name="军团外带单",width = 20,orderNum = "6") | |||||
| private Integer difLegion; | |||||
| @Excel(name="非原军团内部带单",width = 20,orderNum = "7") | |||||
| private Integer difUnion; | |||||
| @Excel(name="原军团内部带单",width = 20,orderNum = "8") | |||||
| private Integer eqUnion; | |||||
| @Excel(name="得分",width = 20,orderNum = "9") | |||||
| private Integer totalScore; | |||||
| } | |||||
| @@ -0,0 +1,15 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.math.BigDecimal; | |||||
| @Data | |||||
| public class LegionActivityOrderStatistics implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Integer auditStatus; | |||||
| private Integer count; | |||||
| } | |||||
| @@ -0,0 +1,15 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| public class LegionActivityOrderTypeStatistics implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long merchantId; | |||||
| private Integer orderType; | |||||
| private Integer count; | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| public class LegionActivitySellOrder implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long cusId; | |||||
| private String cusPhone; | |||||
| @Excel(name = "VIP卡号", width = 20, orderNum = "4") | |||||
| private String cusVipNum; | |||||
| private Long cusMerchantId; | |||||
| @Excel(name="卡属商户",width = 20,orderNum = "6") | |||||
| private String cusMerchantName; | |||||
| @Excel(name="卡属商铺号",width = 20,orderNum = "7") | |||||
| private String cusShopNumber; | |||||
| private Long cusLegionId; | |||||
| @Excel(name = "卡属军团", width = 20, orderNum = "2") | |||||
| private String cusLegionName; | |||||
| private Long cusUnionId; | |||||
| // @Excel(name = "卡属派系", width = 20, orderNum = "3") | |||||
| private String cusUnionName; | |||||
| private Date cusCreateDate; | |||||
| private Long orderId; | |||||
| @Excel(name = "订单号", width = 20, orderNum = "15") | |||||
| private String orderNo; | |||||
| private BigDecimal orderMoney; | |||||
| private Long orderMerchantId; | |||||
| @Excel(name = "订单商户", width = 20, orderNum = "13") | |||||
| private String orderMerchantName; | |||||
| @Excel(name = "订单商户号", width = 20, orderNum = "14") | |||||
| private String orderShopNumber; | |||||
| private Long orderLegionId; | |||||
| @Excel(name = "订单军团", width = 20, orderNum = "11") | |||||
| private String orderLegionName; | |||||
| private Long orderUnionId; | |||||
| // @Excel(name = "订单派系", width = 20, orderNum = "12") | |||||
| private String orderUnionName; | |||||
| private Integer orderType; | |||||
| @Excel(name = "时间", format = "yyyy-MM-dd HH:mm:ss", width = 20, orderNum = "1") | |||||
| private Date orderCreateDate; | |||||
| @Excel(name = "带单积分", width = 20, orderNum = "16") | |||||
| private Integer score; | |||||
| } | |||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import lombok.Data; | |||||
| import java.io.Serializable; | |||||
| @Data | |||||
| public class LegionActivityUserStatistics implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long merchantId; | |||||
| private Integer count; | |||||
| } | |||||
| @@ -0,0 +1,36 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumLegionActivityOrderLegionType { | |||||
| EQ_LEGION(1, "团内"), | |||||
| DIF_LEGION(2, "团外"),; | |||||
| public static EnumLegionActivityOrderLegionType getEnum(Integer code) { | |||||
| for (EnumLegionActivityOrderLegionType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumLegionActivityOrderLegionType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumLegionActivityOrderStatus { | |||||
| AUDTING(0, "审核中"), | |||||
| AUDI_SUCCESS(1, "审批通过"), | |||||
| AUDT_FAIL(2, "审批拒绝"), | |||||
| INVALID(3, "失效"),; | |||||
| public static EnumLegionActivityOrderStatus getEnum(Integer code) { | |||||
| for (EnumLegionActivityOrderStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumLegionActivityOrderStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.iformall.enums; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumLegionActivityOrderType { | |||||
| SIGN_ORDER(0, "签单"), | |||||
| DIF_LEGION(1, "外部军团带单"), | |||||
| DIF_UNION(2, "内部军团不同联盟带单"), | |||||
| EQ_UNION(3, "内部军团相同联盟带单"), | |||||
| NOT_UNION(4, "内部军团无联盟带单"),; | |||||
| public static EnumLegionActivityOrderType getEnum(Integer code) { | |||||
| for (EnumLegionActivityOrderType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumLegionActivityOrderType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public static List<Integer> getDifUnion() { | |||||
| List<Integer> result = new ArrayList<Integer>(); | |||||
| result.add(DIF_LEGION.getCode()); | |||||
| result.add(DIF_UNION.getCode()); | |||||
| result.add(NOT_UNION.getCode()); | |||||
| return result; | |||||
| } | |||||
| public static List<Integer> getEqLegion() { | |||||
| List<Integer> result = new ArrayList<>(); | |||||
| result.add(DIF_UNION.getCode()); | |||||
| result.add(EQ_UNION.getCode()); | |||||
| result.add(NOT_UNION.getCode()); | |||||
| return result; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,36 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumLegionActivityOrderUnionType { | |||||
| EQ_UNION(1, "原联盟"), | |||||
| DIF_UNION(2, "非联盟"),; | |||||
| public static EnumLegionActivityOrderUnionType getEnum(Integer code) { | |||||
| for (EnumLegionActivityOrderUnionType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumLegionActivityOrderUnionType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.enums; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumLegionActivityStatus { | |||||
| DRAFT(0, "草稿"), | |||||
| ON_LINE(1, "已上架"), | |||||
| OFF_LINE(2, "已下架"), | |||||
| EXPIRE(3, "已过期"), | |||||
| NOT_START(4,"未开始") | |||||
| ; | |||||
| public static EnumLegionActivityStatus getEnum(Integer code) { | |||||
| for (EnumLegionActivityStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumLegionActivityStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public static List<Integer> getOffLine() { | |||||
| List<Integer> offLine = new ArrayList<Integer>(); | |||||
| offLine.add(DRAFT.code); | |||||
| offLine.add(OFF_LINE.code); | |||||
| return offLine; | |||||
| } | |||||
| public static List<Integer> getLine() { | |||||
| List<Integer> line = new ArrayList<Integer>(); | |||||
| line.add(ON_LINE.code); | |||||
| line.add(OFF_LINE.code); | |||||
| return line; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,36 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumLegionActivityUserStatus { | |||||
| VALID(0, "有效"), | |||||
| INVALID(1, "失效"),; | |||||
| public static EnumLegionActivityUserStatus getEnum(Integer code) { | |||||
| for (EnumLegionActivityUserStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumLegionActivityUserStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,30 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxLegionActivityConfig; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.iformall.domain.vo.LegionActivityCount; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_config(军团活动军团配置)】的数据库操作Mapper | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| * @Entity com.iformall.domain.po.WxLegionActivityConfig | |||||
| */ | |||||
| public interface WxLegionActivityConfigMapper extends CommonMapper<WxLegionActivityConfig, Long> { | |||||
| void deleteConfig(@Param("activityId")Long activityId, @Param("tenantId")String tenantId); | |||||
| void insertList(@Param("configList")List<WxLegionActivityConfig> legionConfigList); | |||||
| List<WxLegionActivityConfig> findList(WxLegionActivityConfig legionConfig); | |||||
| List<LegionActivityCount> findActivityCount(WxLegionActivityConfig legionConfig); | |||||
| } | |||||
| @@ -0,0 +1,31 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxLegionActivity; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.iformall.domain.po.WxOfflineActivity; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity(军团活动)】的数据库操作Mapper | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| * @Entity com.iformall.domain.po.WxLegionActivity | |||||
| */ | |||||
| public interface WxLegionActivityMapper extends CommonMapper<WxLegionActivity, Long> { | |||||
| WxLegionActivity selectById(@Param("id")Long id, @Param("tenantId")String tenantId); | |||||
| List<WxLegionActivity> findList(WxLegionActivity wxOfflineActivity); | |||||
| void updateStatus(WxLegionActivity wxOfflineActivity); | |||||
| List<Long> findIds(WxLegionActivity wxOfflineActivity); | |||||
| } | |||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxLegionActivityConfig; | |||||
| import com.iformall.domain.po.WxLegionActivityMerchantConfig; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.iformall.domain.vo.LegionActivityCount; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_merchant_config(军团活动商户配置)】的数据库操作Mapper | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| * @Entity com.iformall.domain.po.WxLegionActivityMerchantConfig | |||||
| */ | |||||
| public interface WxLegionActivityMerchantConfigMapper extends CommonMapper<WxLegionActivityMerchantConfig, Long> { | |||||
| void deleteConfig(@Param("activityId")Long activityId, @Param("tenantId")String tenantId); | |||||
| void insertList(@Param("configList") List<WxLegionActivityMerchantConfig> legionConfigList); | |||||
| List<WxLegionActivityMerchantConfig> findList(WxLegionActivityMerchantConfig merchantConfig); | |||||
| List<LegionActivityCount> findActivityCount(WxLegionActivityMerchantConfig merchantConfig); | |||||
| void deleteByIds(WxLegionActivityMerchantConfig merchantConfig); | |||||
| } | |||||
| @@ -0,0 +1,38 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxLegionActivityOrder; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.iformall.domain.vo.LegionActivityOrderStatistics; | |||||
| import com.iformall.domain.vo.LegionActivityOrderTypeStatistics; | |||||
| import com.iformall.domain.vo.LegionActivitySellOrder; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_order(军团活动订单)】的数据库操作Mapper | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| * @Entity com.iformall.domain.po.WxLegionActivityOrder | |||||
| */ | |||||
| public interface WxLegionActivityOrderMapper extends CommonMapper<WxLegionActivityOrder, Long> { | |||||
| List<WxLegionActivityOrder> findList(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| WxLegionActivityOrder selectById(@Param("id")Long id, @Param("tenantId")String tenantId); | |||||
| List<LegionActivityOrderStatistics> auditStatusStatistics(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| void updateAuditStatus(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| List<LegionActivityOrderTypeStatistics> orderTypeStatistics(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| List<LegionActivityOrderTypeStatistics> merchantStatistics(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| List<LegionActivitySellOrder> findOrderUser(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| } | |||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxLegionActivityOrder; | |||||
| import com.iformall.domain.po.WxLegionActivityUser; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.iformall.domain.vo.LegionActivityUserStatistics; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_user(军团活动用户)】的数据库操作Mapper | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| * @Entity com.iformall.domain.po.WxLegionActivityUser | |||||
| */ | |||||
| public interface WxLegionActivityUserMapper extends CommonMapper<WxLegionActivityUser, Long> { | |||||
| List<WxLegionActivityUser> findList(WxLegionActivityUser wxLegionActivityUser); | |||||
| WxLegionActivityUser selectById(@Param("id")Long id, @Param("tenantId")String tenantId); | |||||
| List<Long> findIdList(WxLegionActivityUser wxLegionActivityUser); | |||||
| List<LegionActivityUserStatistics> merchantCountStatistics(WxLegionActivityUser wxLegionActivityUser); | |||||
| void updateStatus(WxLegionActivityUser activityUser); | |||||
| } | |||||
| @@ -0,0 +1,24 @@ | |||||
| package com.iformall.service; | |||||
| import com.iformall.domain.po.WxLegionActivity; | |||||
| import com.iformall.domain.po.WxLegionActivityConfig; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_config(军团活动军团配置)】的数据库操作Service | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| public interface WxLegionActivityConfigService { | |||||
| void handleLegionConfig(WxLegionActivity wxLegionActivity); | |||||
| List<WxLegionActivityConfig> findLegionList(Long activityId, String tenantId); | |||||
| Map<Long, String> getLegionConfigMap(WxLegionActivityConfig legionConfigQ); | |||||
| Map<Long, Integer> findLegionCount(WxLegionActivityConfig legionConfigQ); | |||||
| } | |||||
| @@ -0,0 +1,16 @@ | |||||
| package com.iformall.service; | |||||
| import com.iformall.domain.po.WxLegionActivityMerchantConfig; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_merchant_config(军团活动商户配置)】的数据库操作Service | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| public interface WxLegionActivityMerchantConfigService { | |||||
| Map<Long, Integer> findMerchantCount(WxLegionActivityMerchantConfig merchantConfigQ); | |||||
| } | |||||
| @@ -0,0 +1,46 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxLegionActivity; | |||||
| import com.iformall.domain.po.WxLegionActivityOrder; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import com.iformall.domain.po.WxOfflineActivityRecord; | |||||
| import com.iformall.domain.vo.LegionActivityMerchantStatistics; | |||||
| import com.iformall.domain.vo.LegionActivitySellOrder; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_order(军团活动订单)】的数据库操作Service | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| public interface WxLegionActivityOrderService { | |||||
| PageInfo<WxLegionActivityOrder> listAsPage(WxLegionActivityOrder wxLegionActivityOrder, Integer pageNum, Integer pageSize); | |||||
| void saveOrUpdate(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| WxLegionActivityOrder getInfoById(Long id, String tenantId); | |||||
| Map<String, Integer> getStatistics(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxLegionActivityOrder wxLegionActivityOrder); | |||||
| void auditRecord(WxLegionActivityOrder wxLegionActivityOrder, Long userId); | |||||
| Map<String, Object> getActivityData(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| Map<String, Object> handleActivityData(WxLegionActivity wxLegionActivity, Long legionId); | |||||
| List<LegionActivityMerchantStatistics> getActivityMerchantData(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| void exportActivityMerchantData(HttpServletRequest request, HttpServletResponse response, WxLegionActivityOrder wxLegionActivityOrder); | |||||
| List<LegionActivitySellOrder> getActivitySellOrder(WxLegionActivityOrder wxLegionActivityOrder); | |||||
| void exportActivitySellOrder(HttpServletRequest request, HttpServletResponse response, WxLegionActivityOrder wxLegionActivityOrder); | |||||
| } | |||||
| @@ -0,0 +1,24 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxLegionActivity; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import com.iformall.domain.po.WxOfflineActivity; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity(军团活动)】的数据库操作Service | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| public interface WxLegionActivityService { | |||||
| PageInfo<WxLegionActivity> listAsPage(WxLegionActivity wxLegionActivity, Integer pageNum, Integer pageSize); | |||||
| void saveOrUpdate(WxLegionActivity wxLegionActivity); | |||||
| void updateStatus(WxLegionActivity wxLegionActivity); | |||||
| WxLegionActivity getInfoById(Long id, String tenantId); | |||||
| void delMerchant(WxLegionActivity wxLegionActivity); | |||||
| } | |||||
| @@ -0,0 +1,25 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxLegionActivityUser; | |||||
| import com.baomidou.mybatisplus.extension.service.IService; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_user(军团活动用户)】的数据库操作Service | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| public interface WxLegionActivityUserService { | |||||
| PageInfo<WxLegionActivityUser> listAsPage(WxLegionActivityUser wxLegionActivityUser, Integer pageNum, Integer pageSize); | |||||
| void saveOrUpdate(WxLegionActivityUser wxLegionActivityUser); | |||||
| WxLegionActivityUser getById(Long id, String tenantId); | |||||
| WxLegionActivityUser selectOne(WxLegionActivityUser wxLegionActivityUser); | |||||
| Map<Long, WxLegionActivityUser> findUserMap(WxLegionActivityUser wxLegionActivityUser); | |||||
| } | |||||
| @@ -0,0 +1,125 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxLegionActivity; | |||||
| import com.iformall.domain.po.WxLegionActivityConfig; | |||||
| import com.iformall.domain.po.WxLegionActivityMerchantConfig; | |||||
| import com.iformall.domain.vo.LegionActivityCount; | |||||
| import com.iformall.domain.vo.LegionActivityUserStatistics; | |||||
| import com.iformall.mapper.WxLegionActivityMerchantConfigMapper; | |||||
| import com.iformall.service.WxLegionActivityConfigService; | |||||
| import com.iformall.mapper.WxLegionActivityConfigMapper; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.*; | |||||
| import java.util.stream.Collectors; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_config(军团活动军团配置)】的数据库操作Service实现 | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| @Service | |||||
| public class WxLegionActivityConfigServiceImpl implements WxLegionActivityConfigService{ | |||||
| @Autowired | |||||
| private WxLegionActivityConfigMapper wxLegionActivityConfigMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityMerchantConfigMapper wxLegionActivityMerchantConfigMapper; | |||||
| @Override | |||||
| public void handleLegionConfig(WxLegionActivity wxLegionActivity) { | |||||
| if(wxLegionActivity.getLegionList() == null || wxLegionActivity.getLegionList().isEmpty()){ | |||||
| return; | |||||
| } | |||||
| Date now = new Date(); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| List<WxLegionActivityConfig> legionConfigList = new ArrayList<>(); | |||||
| List<WxLegionActivityMerchantConfig> merchantConfigList = new ArrayList<>(); | |||||
| //军团 | |||||
| for (WxLegionActivityConfig legionConfig : wxLegionActivity.getLegionList()) { | |||||
| if(legionConfig.getId() == null){ | |||||
| legionConfig.setId(idWorker.nextId()); | |||||
| legionConfig.setCreateDate(now); | |||||
| } | |||||
| legionConfig.updateTenantInfo(wxLegionActivity); | |||||
| legionConfig.setActivityId(wxLegionActivity.getId()); | |||||
| legionConfig.setParentId(0L); | |||||
| legionConfig.setUpdateDate(now); | |||||
| legionConfigList.add(legionConfig); | |||||
| //联盟 | |||||
| if (legionConfig.getUnionList() != null && !legionConfig.getUnionList().isEmpty()) { | |||||
| for (WxLegionActivityConfig unionConfig : legionConfig.getUnionList()) { | |||||
| if(unionConfig.getId() == null){ | |||||
| unionConfig.setId(idWorker.nextId()); | |||||
| unionConfig.setCreateDate(now); | |||||
| } | |||||
| unionConfig.updateTenantInfo(wxLegionActivity); | |||||
| unionConfig.setActivityId(wxLegionActivity.getId()); | |||||
| unionConfig.setParentId(legionConfig.getId()); | |||||
| unionConfig.setUpdateDate(now); | |||||
| legionConfigList.add(unionConfig); | |||||
| } | |||||
| } | |||||
| //商户 | |||||
| if(legionConfig.getMerchantList() != null && !legionConfig.getMerchantList().isEmpty()){ | |||||
| for (WxLegionActivityMerchantConfig merchantConfig : legionConfig.getMerchantList()) { | |||||
| if(merchantConfig.getId() == null){ | |||||
| merchantConfig.setId(idWorker.nextId()); | |||||
| merchantConfig.setCreateDate(now); | |||||
| } | |||||
| merchantConfig.updateTenantInfo(wxLegionActivity); | |||||
| merchantConfig.setActivityId(wxLegionActivity.getId()); | |||||
| merchantConfig.setLegionId(legionConfig.getId()); | |||||
| if(merchantConfig.getUnionId() == null){ | |||||
| merchantConfig.setUnionId(0L); | |||||
| } | |||||
| merchantConfig.setUpdateDate(now); | |||||
| merchantConfigList.add(merchantConfig); | |||||
| } | |||||
| } | |||||
| } | |||||
| wxLegionActivityConfigMapper.deleteConfig(wxLegionActivity.getId(),wxLegionActivity.getTenantId()); | |||||
| wxLegionActivityConfigMapper.insertList(legionConfigList); | |||||
| if(!merchantConfigList.isEmpty()){ | |||||
| wxLegionActivityMerchantConfigMapper.deleteConfig(wxLegionActivity.getId(),wxLegionActivity.getTenantId()); | |||||
| wxLegionActivityMerchantConfigMapper.insertList(merchantConfigList); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public List<WxLegionActivityConfig> findLegionList(Long activityId, String tenantId) { | |||||
| WxLegionActivityConfig configQ = new WxLegionActivityConfig(); | |||||
| configQ.setTenantId(tenantId); | |||||
| configQ.setActivityId(activityId); | |||||
| configQ.setParentId(0L); | |||||
| return wxLegionActivityConfigMapper.findList(configQ); | |||||
| } | |||||
| @Override | |||||
| public Map<Long, String> getLegionConfigMap(WxLegionActivityConfig legionConfigQ) { | |||||
| // legionConfigQ.setParentId(0L); | |||||
| List<WxLegionActivityConfig> list = wxLegionActivityConfigMapper.findList(legionConfigQ); | |||||
| if(list == null || list.isEmpty()){ | |||||
| return Collections.emptyMap(); | |||||
| } | |||||
| return list.stream().collect(Collectors.toMap(WxLegionActivityConfig::getId, WxLegionActivityConfig::getName)); | |||||
| } | |||||
| @Override | |||||
| public Map<Long, Integer> findLegionCount(WxLegionActivityConfig legionConfigQ) { | |||||
| List<LegionActivityCount> activityCountList = wxLegionActivityConfigMapper.findActivityCount(legionConfigQ); | |||||
| if (activityCountList == null || activityCountList.isEmpty()){ | |||||
| return Collections.emptyMap(); | |||||
| } | |||||
| return activityCountList.stream().collect(Collectors.toMap(LegionActivityCount::getActivityId, LegionActivityCount::getCount)); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,39 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.iformall.domain.po.WxLegionActivityMerchantConfig; | |||||
| import com.iformall.domain.vo.LegionActivityCount; | |||||
| import com.iformall.service.WxLegionActivityMerchantConfigService; | |||||
| import com.iformall.mapper.WxLegionActivityMerchantConfigMapper; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.Collections; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| import java.util.stream.Collectors; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_merchant_config(军团活动商户配置)】的数据库操作Service实现 | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| @Service | |||||
| public class WxLegionActivityMerchantConfigServiceImpl implements WxLegionActivityMerchantConfigService{ | |||||
| @Autowired | |||||
| private WxLegionActivityMerchantConfigMapper wxLegionActivityMerchantConfigMapper; | |||||
| @Override | |||||
| public Map<Long, Integer> findMerchantCount(WxLegionActivityMerchantConfig merchantConfigQ) { | |||||
| List<LegionActivityCount> activityCountList = wxLegionActivityMerchantConfigMapper.findActivityCount(merchantConfigQ); | |||||
| if (activityCountList == null || activityCountList.isEmpty()){ | |||||
| return Collections.emptyMap(); | |||||
| } | |||||
| return activityCountList.stream().collect(Collectors.toMap(LegionActivityCount::getActivityId, LegionActivityCount::getCount)); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,508 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.domain.dto.cockpit.CountShopByStatusDTO; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.*; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.*; | |||||
| import jodd.util.StringUtil; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.*; | |||||
| import java.util.stream.Collectors; | |||||
| import static java.util.stream.Collectors.groupingBy; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_order(军团活动订单)】的数据库操作Service实现 | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| @Service | |||||
| public class WxLegionActivityOrderServiceImpl implements WxLegionActivityOrderService{ | |||||
| @Autowired | |||||
| private WxLegionActivityOrderMapper wxLegionActivityOrderMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityMapper wxLegionActivityMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityUserMapper wxLegionActivityUserMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityUserService wxLegionActivityUserService; | |||||
| @Autowired | |||||
| private WxLegionActivityConfigService wxLegionActivityConfigService; | |||||
| @Autowired | |||||
| private WxLegionActivityMerchantConfigMapper wxLegionActivityMerchantConfigMapper; | |||||
| @Autowired | |||||
| private WxMerchantMapper wxMerchantMapper; | |||||
| @Autowired | |||||
| private WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| private WxShopService wxShopService; | |||||
| @Autowired | |||||
| private ExcelService excelService; | |||||
| @Autowired | |||||
| private WxLegionActivityConfigMapper wxLegionActivityConfigMapper; | |||||
| @Override | |||||
| public PageInfo<WxLegionActivityOrder> listAsPage(WxLegionActivityOrder wxLegionActivityOrder, Integer pageNum, Integer pageSize) { | |||||
| handlerQuery(wxLegionActivityOrder); | |||||
| PageInfo<WxLegionActivityOrder> recordPageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxLegionActivityOrderMapper.findList(wxLegionActivityOrder)); | |||||
| handlerList(wxLegionActivityOrder, recordPageInfo.getList()); | |||||
| return recordPageInfo; | |||||
| } | |||||
| private void handlerQuery(WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| if (StringUtils.isNotBlank(wxLegionActivityOrder.getMerchantName())) { | |||||
| WxMerchant merchant = new WxMerchant(); | |||||
| merchant.updateTenantInfo(wxLegionActivityOrder); | |||||
| merchant.setName(wxLegionActivityOrder.getMerchantName()); | |||||
| List<Long> mids = wxMerchantMapper.findIdList(merchant); | |||||
| if (null == mids || mids.size() <= 0 ) { | |||||
| wxLegionActivityOrder.setId(-1L); | |||||
| }else { | |||||
| wxLegionActivityOrder.setMerchantIdList(mids); | |||||
| } | |||||
| } | |||||
| if(StringUtils.isNotBlank(wxLegionActivityOrder.getCusPhone()) | |||||
| || StringUtils.isNotBlank(wxLegionActivityOrder.getCusVipNum())){ | |||||
| WxLegionActivityUser user = new WxLegionActivityUser(); | |||||
| user.setActivityId(wxLegionActivityOrder.getActivityId()); | |||||
| user.setPhone(wxLegionActivityOrder.getCusPhone()); | |||||
| user.setVipNum(wxLegionActivityOrder.getCusVipNum()); | |||||
| List<Long> uIds = wxLegionActivityUserMapper.findIdList(user); | |||||
| if (null == uIds || uIds.size() <= 0 ) { | |||||
| wxLegionActivityOrder.setId(-1L); | |||||
| }else { | |||||
| wxLegionActivityOrder.setCusIdList(uIds); | |||||
| } | |||||
| } | |||||
| // if(EnumLegionActivityOrderUnionType.EQ_UNION.getCode().equals(wxLegionActivityOrder.getUnionType())){ | |||||
| // wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.EQ_UNION.getCode()); | |||||
| // } | |||||
| // else if(EnumLegionActivityOrderUnionType.DIF_UNION.getCode().equals(wxLegionActivityOrder.getUnionType())){ | |||||
| // wxLegionActivityOrder.setOrderTypeList(EnumLegionActivityOrderType.getDifUnion()); | |||||
| // } | |||||
| } | |||||
| private void handlerList(WxLegionActivityOrder wxLegionActivityOrder, List<WxLegionActivityOrder> wxLegionActivityOrders) { | |||||
| if (wxLegionActivityOrders == null || wxLegionActivityOrders.isEmpty()) { | |||||
| return; | |||||
| } | |||||
| List<Long> merchantIds = wxLegionActivityOrders.stream().map(WxLegionActivityOrder::getMerchantId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); | |||||
| List<Long> userIds = wxLegionActivityOrders.stream().map(WxLegionActivityOrder::getCusId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); | |||||
| Map<Long, String> merchantMap = new HashMap<>(); | |||||
| if(!merchantIds.isEmpty()){ | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(wxLegionActivityOrder); | |||||
| merchantQ.setIds(merchantIds); | |||||
| merchantMap = wxMerchantService.getIdAndNamesMap(merchantQ); | |||||
| } | |||||
| Map<Long, WxLegionActivityUser> activityUserMap = new HashMap<>(); | |||||
| if(!userIds.isEmpty()){ | |||||
| WxLegionActivityUser userQ = new WxLegionActivityUser(); | |||||
| userQ.updateTenantInfo(wxLegionActivityOrder); | |||||
| userQ.setIds(userIds); | |||||
| activityUserMap = wxLegionActivityUserService.findUserMap(userQ); | |||||
| } | |||||
| WxLegionActivityConfig legionConfigQ = new WxLegionActivityConfig(); | |||||
| legionConfigQ.updateTenantInfo(wxLegionActivityOrder); | |||||
| legionConfigQ.setActivityId(wxLegionActivityOrder.getActivityId()); | |||||
| Map<Long, String> legionConfigMap = wxLegionActivityConfigService.getLegionConfigMap(legionConfigQ); | |||||
| for (WxLegionActivityOrder legionActivityOrder : wxLegionActivityOrders) { | |||||
| WxLegionActivityUser user = activityUserMap.get(legionActivityOrder.getCusId()); | |||||
| if (null != user) { | |||||
| legionActivityOrder.setCusPhone(user.getPhone()); | |||||
| legionActivityOrder.setCusVipNum(user.getVipNum()); | |||||
| } | |||||
| legionActivityOrder.setMerchantName(merchantMap.get(legionActivityOrder.getMerchantId())); | |||||
| if(legionActivityOrder.getLegionId().equals(0L)){ | |||||
| legionActivityOrder.setLegionName("未参加活动"); | |||||
| }else{ | |||||
| legionActivityOrder.setLegionName(legionConfigMap.get(legionActivityOrder.getLegionId())); | |||||
| } | |||||
| // if(EnumLegionActivityOrderType.EQ_UNION.getCode().equals(wxLegionActivityOrder.getOrderType())){ | |||||
| // wxLegionActivityOrder.setUnionType(EnumLegionActivityOrderUnionType.EQ_UNION.getCode()); | |||||
| // }else{ | |||||
| // wxLegionActivityOrder.setUnionType(EnumLegionActivityOrderUnionType.DIF_UNION.getCode()); | |||||
| // } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| WxLegionActivityUser user = wxLegionActivityUserMapper.selectById(wxLegionActivityOrder.getCusId(), wxLegionActivityOrder.getTenantId()); | |||||
| if (user == null || EnumLegionActivityUserStatus.INVALID.getCode().equals(user.getStatus())) { | |||||
| throw new MallinkException(Result.ERROR,"未查询到有效用户"); | |||||
| } | |||||
| if(!user.getPhone().equals(wxLegionActivityOrder.getCusPhone())){ | |||||
| throw new MallinkException(Result.ERROR,"用户信息错误"); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityOrder.getCusName())){ | |||||
| wxLegionActivityOrder.setCusName(user.getName()); | |||||
| } | |||||
| if(StringUtil.isBlank(wxLegionActivityOrder.getCusAddress())){ | |||||
| wxLegionActivityOrder.setCusAddress(user.getAddress()); | |||||
| } | |||||
| WxLegionActivityMerchantConfig merchantConfigQuery = new WxLegionActivityMerchantConfig(); | |||||
| merchantConfigQuery.updateTenantInfo(wxLegionActivityOrder); | |||||
| merchantConfigQuery.setActivityId(wxLegionActivityOrder.getActivityId()); | |||||
| merchantConfigQuery.setMerchantId(wxLegionActivityOrder.getMerchantId()); | |||||
| WxLegionActivityMerchantConfig merchantConfig = wxLegionActivityMerchantConfigMapper.selectOne(new QueryWrapper<>(merchantConfigQuery)); | |||||
| if(merchantConfig != null){ | |||||
| wxLegionActivityOrder.setLegionId(merchantConfig.getLegionId()); | |||||
| wxLegionActivityOrder.setUnionId(merchantConfig.getUnionId()); | |||||
| }else{ | |||||
| wxLegionActivityOrder.setLegionId(0L); | |||||
| wxLegionActivityOrder.setUnionId(0L); | |||||
| } | |||||
| if(wxLegionActivityOrder.getMerchantId().equals(user.getMerchantId())){ | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.SIGN_ORDER.getCode()); | |||||
| } | |||||
| else if(wxLegionActivityOrder.getLegionId().equals(0L) || user.getLegionId().equals(0L)){ | |||||
| //未参加活动 提交订单(外部军团带单) | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.DIF_LEGION.getCode()); | |||||
| }else if(wxLegionActivityOrder.getLegionId().equals(user.getLegionId())){ | |||||
| //订单军团与用户军团一致 | |||||
| if(wxLegionActivityOrder.getUnionId().equals(0L) || user.getUnionId().equals(0L)){ | |||||
| //订单/用户无联盟(内部军团无联盟带单) | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.NOT_UNION.getCode()); | |||||
| }else if(wxLegionActivityOrder.getUnionId().equals(user.getUnionId())){ | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.EQ_UNION.getCode()); | |||||
| }else{ | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.DIF_UNION.getCode()); | |||||
| } | |||||
| }else{ | |||||
| if(wxLegionActivityOrder.getUnionId().equals(0L) || user.getUnionId().equals(0L)){ | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.NOT_UNION.getCode()); | |||||
| }else{ | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.DIF_LEGION.getCode()); | |||||
| } | |||||
| } | |||||
| Date now = new Date(); | |||||
| if(wxLegionActivityOrder.getId() == null){ | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxLegionActivityOrder.setId(idWorker.nextId()); | |||||
| wxLegionActivityOrder.setCreateDate(now); | |||||
| wxLegionActivityOrder.setUpdateDate(now); | |||||
| wxLegionActivityOrder.setAuditStatus(EnumLegionActivityOrderStatus.AUDTING.getCode()); | |||||
| wxLegionActivityOrderMapper.insert(wxLegionActivityOrder); | |||||
| } | |||||
| else{ | |||||
| wxLegionActivityOrder.setAuditRemark(""); | |||||
| wxLegionActivityOrder.setAuditStatus(EnumLegionActivityOrderStatus.AUDTING.getCode()); | |||||
| wxLegionActivityOrder.setUpdateDate(now); | |||||
| wxLegionActivityOrderMapper.updateById(wxLegionActivityOrder); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public WxLegionActivityOrder getInfoById(Long id, String tenantId) { | |||||
| WxLegionActivityOrder wxLegionActivityOrder = wxLegionActivityOrderMapper.selectById(id, tenantId); | |||||
| if(wxLegionActivityOrder == null){ | |||||
| return null; | |||||
| } | |||||
| WxLegionActivityUser user = wxLegionActivityUserMapper.selectById(wxLegionActivityOrder.getCusId(), wxLegionActivityOrder.getTenantId()); | |||||
| wxLegionActivityOrder.setCusPhone(user.getPhone()); | |||||
| wxLegionActivityOrder.setCusVipNum(user.getVipNum()); | |||||
| WxMerchant merchant = wxMerchantMapper.selectById(wxLegionActivityOrder.getMerchantId()); | |||||
| wxLegionActivityOrder.setMerchantName(merchant.getName()); | |||||
| if(wxLegionActivityOrder.getLegionId().equals(0L)){ | |||||
| wxLegionActivityOrder.setLegionName("未参加活动"); | |||||
| }else{ | |||||
| WxLegionActivityConfig legionActivityConfig = wxLegionActivityConfigMapper.selectById(wxLegionActivityOrder.getLegionId()); | |||||
| wxLegionActivityOrder.setLegionName(legionActivityConfig.getName()); | |||||
| } | |||||
| // if(EnumLegionActivityOrderType.EQ_UNION.getCode().equals(wxLegionActivityOrder.getOrderType())){ | |||||
| // wxLegionActivityOrder.setUnionType(EnumLegionActivityOrderUnionType.EQ_UNION.getCode()); | |||||
| // }else{ | |||||
| // wxLegionActivityOrder.setUnionType(EnumLegionActivityOrderUnionType.DIF_UNION.getCode()); | |||||
| // } | |||||
| return wxLegionActivityOrder; | |||||
| } | |||||
| @Override | |||||
| public Map<String, Integer> getStatistics(WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| List<LegionActivityOrderStatistics> auditStatusStatistics = wxLegionActivityOrderMapper.auditStatusStatistics(wxLegionActivityOrder); | |||||
| Map<String, Integer> result = new HashMap<>(); | |||||
| Integer audting = 0, audi_success = 0, audt_fail = 0, invalid = 0; | |||||
| for(LegionActivityOrderStatistics statistics : auditStatusStatistics){ | |||||
| if(EnumLegionActivityOrderStatus.AUDTING.getCode().equals(statistics.getAuditStatus())){ | |||||
| audting = statistics.getCount(); | |||||
| } else if (EnumLegionActivityOrderStatus.AUDI_SUCCESS.getCode().equals(statistics.getAuditStatus())) { | |||||
| audi_success = statistics.getCount(); | |||||
| } else if (EnumLegionActivityOrderStatus.AUDT_FAIL.getCode().equals(statistics.getAuditStatus())) { | |||||
| audt_fail = statistics.getCount(); | |||||
| } else if (EnumLegionActivityOrderStatus.INVALID.getCode().equals(statistics.getAuditStatus())) { | |||||
| invalid = statistics.getCount(); | |||||
| } | |||||
| } | |||||
| result.put("audting",audting); | |||||
| result.put("audi_success",audi_success); | |||||
| result.put("audt_fail",audt_fail); | |||||
| result.put("invalid",invalid); | |||||
| result.put("sum_count",audting+audi_success+audt_fail+invalid); | |||||
| return result; | |||||
| } | |||||
| @Override | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| handlerQuery(wxLegionActivityOrder); | |||||
| List<WxLegionActivityOrder> list = wxLegionActivityOrderMapper.findList(wxLegionActivityOrder); | |||||
| handlerList(wxLegionActivityOrder, list); | |||||
| excelService.exportExcel(list, null, "军团活动订单列表", WxLegionActivityOrder.class, "军团活动订单列表.xlsx", response, false); | |||||
| } | |||||
| @Override | |||||
| public void auditRecord(WxLegionActivityOrder wxLegionActivityOrder, Long userId) { | |||||
| Date now = new Date(); | |||||
| wxLegionActivityOrder.setUpdateDate(now); | |||||
| wxLegionActivityOrder.setAuditTime(now); | |||||
| wxLegionActivityOrder.setAuditBy(userId); | |||||
| wxLegionActivityOrderMapper.updateAuditStatus(wxLegionActivityOrder); | |||||
| } | |||||
| @Override | |||||
| public Map<String, Object> getActivityData(WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| WxLegionActivity activity = wxLegionActivityMapper.selectById(wxLegionActivityOrder.getActivityId(), wxLegionActivityOrder.getTenantId()); | |||||
| if(activity == null){ | |||||
| throw new MallinkException(Result.ERROR,"未查询到活动"); | |||||
| } | |||||
| return handleActivityData(activity,wxLegionActivityOrder.getLegionId()); | |||||
| } | |||||
| @Override | |||||
| public Map<String, Object> handleActivityData(WxLegionActivity activity, Long legionId) { | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| WxLegionActivityUser userQ = new WxLegionActivityUser(); | |||||
| userQ.updateTenantInfo(activity); | |||||
| userQ.setActivityId(activity.getId()); | |||||
| userQ.setLegionId(legionId); | |||||
| userQ.setStatus(EnumLegionActivityUserStatus.VALID.getCode()); | |||||
| Integer userCount = wxLegionActivityUserMapper.selectCount(new QueryWrapper<>(userQ)); | |||||
| result.put("userCount",userCount); | |||||
| WxLegionActivityOrder orderQ = new WxLegionActivityOrder(); | |||||
| orderQ.updateTenantInfo(activity); | |||||
| orderQ.setActivityId(activity.getId()); | |||||
| orderQ.setLegionId(legionId); | |||||
| orderQ.setAuditStatus(EnumLegionActivityOrderStatus.AUDI_SUCCESS.getCode()); | |||||
| List<LegionActivityOrderTypeStatistics> orderTypeStatistics = wxLegionActivityOrderMapper.orderTypeStatistics(orderQ); | |||||
| Integer sign_order = 0,dif_legion = 0,dif_union = 0,eq_union = 0,not_union = 0; | |||||
| for(LegionActivityOrderTypeStatistics statistics : orderTypeStatistics){ | |||||
| if(EnumLegionActivityOrderType.SIGN_ORDER.getCode().equals(statistics.getOrderType())){ | |||||
| sign_order = statistics.getCount(); | |||||
| }else if (EnumLegionActivityOrderType.DIF_LEGION.getCode().equals(statistics.getOrderType())){ | |||||
| dif_legion = statistics.getCount(); | |||||
| }else if(EnumLegionActivityOrderType.DIF_UNION.getCode().equals(statistics.getOrderType())){ | |||||
| dif_union = statistics.getCount(); | |||||
| }else if(EnumLegionActivityOrderType.EQ_UNION.getCode().equals(statistics.getOrderType())){ | |||||
| eq_union = statistics.getCount(); | |||||
| }else if(EnumLegionActivityOrderType.NOT_UNION.getCode().equals(statistics.getOrderType())){ | |||||
| not_union = statistics.getCount(); | |||||
| } | |||||
| } | |||||
| //签单=总订单数 | |||||
| Integer order_count = sign_order+dif_legion+dif_union+eq_union+not_union; | |||||
| result.put("orderCount",order_count); | |||||
| //带单 | |||||
| result.put("sellOrderCount",dif_legion+dif_union+eq_union+not_union); | |||||
| result.put("difLegion",dif_legion); | |||||
| result.put("eqUnion",eq_union); | |||||
| result.put("difUnion",dif_union+not_union); | |||||
| Integer total_score = userCount*activity.getSellingCard()+order_count*activity.getSignOrder() | |||||
| +dif_legion*activity.getDifLegionOrder()+dif_union*activity.getDifUnionOrder() | |||||
| +eq_union*activity.getEqUnionOrder()+not_union*activity.getNotUnionOrder(); | |||||
| result.put("totalScore",total_score); | |||||
| return result; | |||||
| } | |||||
| @Override | |||||
| public List<LegionActivityMerchantStatistics> getActivityMerchantData(WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| WxLegionActivity activity = wxLegionActivityMapper.selectById(wxLegionActivityOrder.getActivityId(), wxLegionActivityOrder.getTenantId()); | |||||
| if(activity == null){ | |||||
| throw new MallinkException(Result.ERROR,"未查询到活动"); | |||||
| } | |||||
| WxLegionActivityOrder orderQ = new WxLegionActivityOrder(); | |||||
| orderQ.updateTenantInfo(activity); | |||||
| orderQ.setActivityId(activity.getId()); | |||||
| orderQ.setAuditStatus(EnumLegionActivityOrderStatus.AUDI_SUCCESS.getCode()); | |||||
| List<LegionActivityOrderTypeStatistics> merchantStatistics = wxLegionActivityOrderMapper.merchantStatistics(orderQ); | |||||
| if(merchantStatistics == null || merchantStatistics.isEmpty()){ | |||||
| return Collections.emptyList(); | |||||
| } | |||||
| List<Long> merchantIds = merchantStatistics.stream().map(LegionActivityOrderTypeStatistics::getMerchantId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(activity); | |||||
| merchantQ.setIds(merchantIds); | |||||
| Map<Long, String> idAndNamesMap = wxMerchantService.getIdAndNamesMap(merchantQ); | |||||
| Map<Long,String> merchantShopNumberMap = wxShopService.getMerchantShopNumberMap(activity, merchantIds, EnumYesOrNo.NO.getCode()); | |||||
| Map<Long, List<LegionActivityOrderTypeStatistics>> merchantStatisticsMap = merchantStatistics.stream().collect(groupingBy(LegionActivityOrderTypeStatistics::getMerchantId)); | |||||
| WxLegionActivityUser userQ = new WxLegionActivityUser(); | |||||
| userQ.updateTenantInfo(activity); | |||||
| userQ.setActivityId(activity.getId()); | |||||
| userQ.setStatus(EnumLegionActivityUserStatus.VALID.getCode()); | |||||
| List<LegionActivityUserStatistics> merchantCountStatistics = wxLegionActivityUserMapper.merchantCountStatistics(userQ); | |||||
| Map<Long, Integer> merchantCountStatisticsMap = merchantCountStatistics.stream().collect(Collectors.toMap(LegionActivityUserStatistics::getMerchantId, LegionActivityUserStatistics::getCount)); | |||||
| List<LegionActivityMerchantStatistics> merchantStatisticsList = new ArrayList<>(); | |||||
| for (Long merchantId : merchantStatisticsMap.keySet()) { | |||||
| LegionActivityMerchantStatistics merchantS = new LegionActivityMerchantStatistics(); | |||||
| merchantS.setMerchantId(merchantId); | |||||
| merchantS.setMerchantName(idAndNamesMap.get(merchantId)); | |||||
| merchantS.setShopNumber(merchantShopNumberMap.get(merchantId)); | |||||
| Integer userCount = merchantCountStatisticsMap.get(merchantId)==null?0:merchantCountStatisticsMap.get(merchantId); | |||||
| merchantS.setUserCount(userCount); | |||||
| Integer sign_order = 0,dif_legion = 0,dif_union = 0,eq_union = 0,not_union = 0; | |||||
| for(LegionActivityOrderTypeStatistics statistics : merchantStatisticsMap.get(merchantId)){ | |||||
| if(EnumLegionActivityOrderType.SIGN_ORDER.getCode().equals(statistics.getOrderType())){ | |||||
| sign_order = statistics.getCount(); | |||||
| }else if (EnumLegionActivityOrderType.DIF_LEGION.getCode().equals(statistics.getOrderType())){ | |||||
| dif_legion = statistics.getCount(); | |||||
| }else if(EnumLegionActivityOrderType.DIF_UNION.getCode().equals(statistics.getOrderType())){ | |||||
| dif_union = statistics.getCount(); | |||||
| }else if(EnumLegionActivityOrderType.EQ_UNION.getCode().equals(statistics.getOrderType())){ | |||||
| eq_union = statistics.getCount(); | |||||
| }else if(EnumLegionActivityOrderType.NOT_UNION.getCode().equals(statistics.getOrderType())){ | |||||
| not_union = statistics.getCount(); | |||||
| } | |||||
| } | |||||
| //签单=总订单数 | |||||
| Integer order_count = sign_order+dif_legion+dif_union+eq_union+not_union; | |||||
| merchantS.setOrderCount(order_count); | |||||
| //带单 | |||||
| merchantS.setSellOrderCount(dif_legion+dif_union+eq_union+not_union); | |||||
| merchantS.setDifLegion(dif_legion); | |||||
| merchantS.setEqUnion(eq_union); | |||||
| merchantS.setDifUnion(dif_union+not_union); | |||||
| Integer total_score = userCount*activity.getSellingCard()+order_count*activity.getSignOrder() | |||||
| +dif_legion*activity.getDifLegionOrder()+dif_union*activity.getDifUnionOrder() | |||||
| +eq_union*activity.getEqUnionOrder()+not_union*activity.getNotUnionOrder(); | |||||
| merchantS.setTotalScore(total_score); | |||||
| merchantStatisticsList.add(merchantS); | |||||
| } | |||||
| return merchantStatisticsList; | |||||
| } | |||||
| @Override | |||||
| public void exportActivityMerchantData(HttpServletRequest request, HttpServletResponse response, WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| List<LegionActivityMerchantStatistics> activityMerchantDate = getActivityMerchantData(wxLegionActivityOrder); | |||||
| excelService.exportExcel(activityMerchantDate, null, "军团活动数据(门店)", LegionActivityMerchantStatistics.class, "军团活动数据(门店).xlsx", response, false); | |||||
| } | |||||
| @Override | |||||
| public List<LegionActivitySellOrder> getActivitySellOrder(WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| WxLegionActivity activity = wxLegionActivityMapper.selectById(wxLegionActivityOrder.getActivityId(), wxLegionActivityOrder.getTenantId()); | |||||
| if(activity == null){ | |||||
| throw new MallinkException(Result.ERROR,"未查询到活动"); | |||||
| } | |||||
| if(wxLegionActivityOrder.getLegionType() == null){ | |||||
| wxLegionActivityOrder.setLegionType(EnumLegionActivityOrderLegionType.EQ_LEGION.getCode()); | |||||
| } | |||||
| if(EnumLegionActivityOrderLegionType.EQ_LEGION.getCode().equals(wxLegionActivityOrder.getLegionType())){ | |||||
| wxLegionActivityOrder.setOrderTypeList(EnumLegionActivityOrderType.getEqLegion()); | |||||
| }else{ | |||||
| wxLegionActivityOrder.setLegionType(EnumLegionActivityOrderLegionType.DIF_LEGION.getCode()); | |||||
| wxLegionActivityOrder.setOrderType(EnumLegionActivityOrderType.DIF_LEGION.getCode()); | |||||
| } | |||||
| wxLegionActivityOrder.setAuditStatus(EnumLegionActivityOrderStatus.AUDI_SUCCESS.getCode()); | |||||
| List<LegionActivitySellOrder> sellOrderList = wxLegionActivityOrderMapper.findOrderUser(wxLegionActivityOrder); | |||||
| if(sellOrderList == null || sellOrderList.isEmpty()){ | |||||
| return sellOrderList; | |||||
| } | |||||
| List<Long> merchantIds = sellOrderList.stream().flatMap(sellOrder -> Arrays.stream(new Long[]{sellOrder.getCusMerchantId(), sellOrder.getOrderMerchantId()})).distinct().collect(Collectors.toList()); | |||||
| // List<Long> merchantIds = sellOrderList.stream().map(LegionActivitySellOrder::getOrderMerchantId).filter(Objects::nonNull).distinct().collect(Collectors.toList()); | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(activity); | |||||
| merchantQ.setIds(merchantIds); | |||||
| Map<Long, String> idAndNamesMap = wxMerchantService.getIdAndNamesMap(merchantQ); | |||||
| Map<Long,String> merchantShopNumberMap = wxShopService.getMerchantShopNumberMap(activity, merchantIds, EnumYesOrNo.NO.getCode()); | |||||
| WxLegionActivityConfig legionConfigQ = new WxLegionActivityConfig(); | |||||
| legionConfigQ.updateTenantInfo(wxLegionActivityOrder); | |||||
| legionConfigQ.setActivityId(wxLegionActivityOrder.getActivityId()); | |||||
| Map<Long, String> legionConfigMap = wxLegionActivityConfigService.getLegionConfigMap(legionConfigQ); | |||||
| for (LegionActivitySellOrder sellOrder : sellOrderList) { | |||||
| sellOrder.setCusMerchantName(idAndNamesMap.get(sellOrder.getCusMerchantId())); | |||||
| sellOrder.setCusShopNumber(merchantShopNumberMap.get(sellOrder.getCusMerchantId())); | |||||
| if(sellOrder.getCusLegionId().equals(0L)){ | |||||
| sellOrder.setCusLegionName("未参加活动"); | |||||
| }else{ | |||||
| sellOrder.setCusLegionName(legionConfigMap.get(sellOrder.getCusLegionId())); | |||||
| } | |||||
| sellOrder.setOrderMerchantName(idAndNamesMap.get(sellOrder.getOrderMerchantId())); | |||||
| sellOrder.setOrderShopNumber(merchantShopNumberMap.get(sellOrder.getOrderMerchantId())); | |||||
| if(sellOrder.getOrderLegionId().equals(0L)){ | |||||
| sellOrder.setOrderLegionName("未参加活动"); | |||||
| }else{ | |||||
| sellOrder.setOrderLegionName(legionConfigMap.get(sellOrder.getOrderLegionId())); | |||||
| } | |||||
| if(EnumLegionActivityOrderType.DIF_LEGION.getCode().equals(sellOrder.getOrderType())){ | |||||
| sellOrder.setScore(activity.getDifLegionOrder()); | |||||
| } else if(EnumLegionActivityOrderType.DIF_UNION.getCode().equals(sellOrder.getOrderType())) { | |||||
| sellOrder.setScore(activity.getDifUnionOrder()); | |||||
| } else if (EnumLegionActivityOrderType.EQ_UNION.getCode().equals(sellOrder.getOrderType())) { | |||||
| sellOrder.setScore(activity.getEqUnionOrder()); | |||||
| } else if (EnumLegionActivityOrderType.NOT_UNION.getCode().equals(sellOrder.getOrderType())) { | |||||
| sellOrder.setScore(activity.getNotUnionOrder()); | |||||
| } | |||||
| } | |||||
| return sellOrderList; | |||||
| } | |||||
| @Override | |||||
| public void exportActivitySellOrder(HttpServletRequest request, HttpServletResponse response, WxLegionActivityOrder wxLegionActivityOrder) { | |||||
| List<LegionActivitySellOrder> activitySellOrder = getActivitySellOrder(wxLegionActivityOrder); | |||||
| String legionTypeStr = EnumLegionActivityOrderLegionType.getEnum(wxLegionActivityOrder.getLegionType()).getMessage(); | |||||
| excelService.exportExcel(activitySellOrder, null, "军团带单数据("+legionTypeStr+")", LegionActivitySellOrder.class, "军团带单数据("+legionTypeStr+").xlsx", response, false); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,273 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.*; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import java.util.*; | |||||
| import java.util.stream.Collectors; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity(军团活动)】的数据库操作Service实现 | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| @Service | |||||
| public class WxLegionActivityServiceImpl implements WxLegionActivityService{ | |||||
| @Autowired | |||||
| private WxLegionActivityMapper wxLegionActivityMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityConfigMapper wxLegionActivityConfigMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityMerchantConfigMapper wxLegionActivityMerchantConfigMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityConfigService wxLegionActivityConfigService; | |||||
| @Autowired | |||||
| private WxLegionActivityUserMapper wxLegionActivityUserMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityOrderMapper wxLegionActivityOrderMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityMerchantConfigService wxLegionActivityMerchantConfigService; | |||||
| @Autowired | |||||
| private WxLegionActivityOrderService wxLegionActivityOrderService; | |||||
| @Autowired | |||||
| private WxMerchantService wxMerchantService; | |||||
| @Override | |||||
| public PageInfo<WxLegionActivity> listAsPage(WxLegionActivity record, Integer pageNum, Integer pageSize) { | |||||
| handlerQuery(record); | |||||
| PageInfo<WxLegionActivity> activityPageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxLegionActivityMapper.findList(record)); | |||||
| handlerList(record,activityPageInfo.getList()); | |||||
| return activityPageInfo; | |||||
| } | |||||
| private void handlerQuery(WxLegionActivity record) { | |||||
| if (null != record.getStatus()) { | |||||
| //已上架 | |||||
| if(EnumLegionActivityStatus.ON_LINE.getCode().equals(record.getStatus())){ | |||||
| record.setValidStatus(EnumYesOrNo.NO.getCode()); | |||||
| // record.setStartStatus(EnumYesOrNo.YES.getCode()); | |||||
| } | |||||
| //未上架 | |||||
| if(EnumLegionActivityStatus.OFF_LINE.getCode().equals(record.getStatus())){ | |||||
| record.setStatus(null); | |||||
| List<Integer> offLine = EnumLegionActivityStatus.getOffLine(); | |||||
| if(record.getStatusList() != null && !record.getStatusList().isEmpty()){ | |||||
| offLine.retainAll(record.getStatusList()); | |||||
| } | |||||
| record.setStatusList(offLine); | |||||
| } | |||||
| //已过期 | |||||
| else if(EnumLegionActivityStatus.EXPIRE.getCode().equals(record.getStatus())){ | |||||
| record.setStatus(EnumLegionActivityStatus.ON_LINE.getCode()); | |||||
| record.setValidStatus(EnumYesOrNo.YES.getCode()); | |||||
| } | |||||
| //未开始 | |||||
| else if(EnumLegionActivityStatus.NOT_START.getCode().equals(record.getStatus())){ | |||||
| record.setStatus(EnumLegionActivityStatus.ON_LINE.getCode()); | |||||
| record.setStartStatus(EnumYesOrNo.NO.getCode()); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void handlerList(WxLegionActivity record,List<WxLegionActivity> list) { | |||||
| if(list == null || list.isEmpty()){ | |||||
| return; | |||||
| } | |||||
| List<Long> ids = list.stream().map(WxLegionActivity::getId).collect(Collectors.toList()); | |||||
| WxLegionActivityConfig legionConfigQ = new WxLegionActivityConfig(); | |||||
| legionConfigQ.updateTenantInfo(record); | |||||
| legionConfigQ.setActivityIdList(ids); | |||||
| Map<Long, String> legionConfigMap = wxLegionActivityConfigService.getLegionConfigMap(legionConfigQ); | |||||
| legionConfigQ.setParentId(0L); | |||||
| Map<Long,Integer> legionCountMap = wxLegionActivityConfigService.findLegionCount(legionConfigQ); | |||||
| WxLegionActivityMerchantConfig merchantConfigQ = new WxLegionActivityMerchantConfig(); | |||||
| merchantConfigQ.updateTenantInfo(record); | |||||
| merchantConfigQ.setActivityIdList(ids); | |||||
| Map<Long,Integer> merchantCountMap = wxLegionActivityMerchantConfigService.findMerchantCount(merchantConfigQ); | |||||
| Date now = new Date(); | |||||
| for (WxLegionActivity activity : list) { | |||||
| if(EnumLegionActivityStatus.ON_LINE.getCode().equals(activity.getStatus())){ | |||||
| if(now.before(activity.getStartTime())){ | |||||
| activity.setStatus(EnumLegionActivityStatus.NOT_START.getCode()); | |||||
| } | |||||
| if(now.after(activity.getEndTime())){ | |||||
| activity.setStatus(EnumLegionActivityStatus.EXPIRE.getCode()); | |||||
| } | |||||
| } | |||||
| activity.setLegionCount(legionCountMap.get(activity.getId())==null?0:legionCountMap.get(activity.getId())); | |||||
| activity.setMerchantCount(merchantCountMap.get(activity.getId())==null?0:merchantCountMap.get(activity.getId())); | |||||
| //处理数量 | |||||
| if(record.isNeedCount()){ | |||||
| activity.setActivityData(wxLegionActivityOrderService.handleActivityData(activity,null)); | |||||
| } | |||||
| //处理商户所属 | |||||
| if(record.getMerchantId() != null){ | |||||
| WxLegionActivityMerchantConfig merchantQ = new WxLegionActivityMerchantConfig(); | |||||
| merchantQ.updateTenantInfo(activity); | |||||
| merchantQ.setActivityId(activity.getId()); | |||||
| merchantQ.setMerchantId(record.getMerchantId()); | |||||
| WxLegionActivityMerchantConfig merchantConfig = wxLegionActivityMerchantConfigMapper.selectOne(new QueryWrapper<>(merchantQ)); | |||||
| if(merchantConfig == null || merchantConfig.getLegionId().equals(0L)){ | |||||
| activity.setLegionName("无军团"); | |||||
| activity.setUnionName("无联盟"); | |||||
| }else{ | |||||
| activity.setLegionName(legionConfigMap.get(merchantConfig.getLegionId())); | |||||
| activity.setUnionName(merchantConfig.getUnionId().equals(0L)?"无联盟":legionConfigMap.get(merchantConfig.getUnionId())); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | |||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public void saveOrUpdate(WxLegionActivity wxLegionActivity) { | |||||
| Date now = new Date(); | |||||
| if(wxLegionActivity.getSellingCard() == null){ | |||||
| wxLegionActivity.setSellingCard(0); | |||||
| } | |||||
| if(wxLegionActivity.getSignOrder() == null){ | |||||
| wxLegionActivity.setSignOrder(0); | |||||
| } | |||||
| if(wxLegionActivity.getDifLegionOrder() == null){ | |||||
| wxLegionActivity.setDifLegionOrder(0); | |||||
| } | |||||
| if(wxLegionActivity.getDifUnionOrder() == null){ | |||||
| wxLegionActivity.setDifUnionOrder(0); | |||||
| } | |||||
| if(wxLegionActivity.getEqUnionOrder() == null){ | |||||
| wxLegionActivity.setEqUnionOrder(0); | |||||
| } | |||||
| if(wxLegionActivity.getNotUnionOrder() == null){ | |||||
| wxLegionActivity.setNotUnionOrder(0); | |||||
| } | |||||
| if(wxLegionActivity.getId() == null){ | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxLegionActivity.setId(idWorker.nextId()); | |||||
| wxLegionActivity.setCreateDate(now); | |||||
| wxLegionActivity.setCreateDate(now); | |||||
| wxLegionActivity.setStatus(EnumLegionActivityStatus.DRAFT.getCode()); | |||||
| wxLegionActivityMapper.insert(wxLegionActivity); | |||||
| } | |||||
| else{ | |||||
| WxLegionActivity activity = wxLegionActivityMapper.selectById(wxLegionActivity.getId(), wxLegionActivity.getTenantId()); | |||||
| if(!EnumLegionActivityStatus.DRAFT.getCode().equals(activity.getStatus())){ | |||||
| throw new MallinkException(Result.ERROR,"活动状态不允许修改"); | |||||
| } | |||||
| wxLegionActivity.setUpdateDate(now); | |||||
| wxLegionActivityMapper.updateById(wxLegionActivity); | |||||
| } | |||||
| //处理军团配置 | |||||
| wxLegionActivityConfigService.handleLegionConfig(wxLegionActivity); | |||||
| } | |||||
| @Override | |||||
| public void updateStatus(WxLegionActivity wxLegionActivity) { | |||||
| wxLegionActivityMapper.updateStatus(wxLegionActivity); | |||||
| } | |||||
| @Override | |||||
| public WxLegionActivity getInfoById(Long id, String tenantId) { | |||||
| WxLegionActivity activity = wxLegionActivityMapper.selectById(id, tenantId); | |||||
| if(activity == null){ | |||||
| return activity; | |||||
| } | |||||
| //获取军团配置 | |||||
| WxLegionActivityConfig legionConfigQ = new WxLegionActivityConfig(); | |||||
| legionConfigQ.updateTenantInfo(activity); | |||||
| legionConfigQ.setActivityId(activity.getId()); | |||||
| List<WxLegionActivityConfig> legionConfigList = wxLegionActivityConfigMapper.findList(legionConfigQ); | |||||
| if(legionConfigList == null || legionConfigList.isEmpty()){ | |||||
| return activity; | |||||
| } | |||||
| Map<Long, List<WxLegionActivityConfig>> legionConfigMap = legionConfigList.stream().collect(Collectors.groupingBy(WxLegionActivityConfig::getParentId)); | |||||
| //获取商户配置 | |||||
| Map<Long, List<WxLegionActivityMerchantConfig>> merchantConfigMap = new HashMap<>(); | |||||
| WxLegionActivityMerchantConfig merchantConfigQ = new WxLegionActivityMerchantConfig(); | |||||
| merchantConfigQ.updateTenantInfo(activity); | |||||
| merchantConfigQ.setActivityId(activity.getId()); | |||||
| List<WxLegionActivityMerchantConfig> merchantConfigList = wxLegionActivityMerchantConfigMapper.findList(merchantConfigQ); | |||||
| if(merchantConfigList != null && !merchantConfigList.isEmpty()){ | |||||
| List<Long> merchantIds = merchantConfigList.stream().map(WxLegionActivityMerchantConfig::getMerchantId).filter(Objects::nonNull).collect(Collectors.toList()); | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(activity); | |||||
| merchantQ.setIds(merchantIds); | |||||
| Map<Long, WxMerchant> merchantMap = wxMerchantService.findMerchantMap(merchantQ); | |||||
| for(WxLegionActivityMerchantConfig merchantConfig : merchantConfigList){ | |||||
| WxMerchant merchant = merchantMap.get(merchantConfig.getMerchantId()); | |||||
| if(merchant != null){ | |||||
| merchantConfig.setMerchantName(merchant.getName()); | |||||
| merchantConfig.setMerchantPhone(merchant.getLinkPhone()); | |||||
| } | |||||
| } | |||||
| merchantConfigMap = merchantConfigList.stream().collect(Collectors.groupingBy(WxLegionActivityMerchantConfig::getLegionId)); | |||||
| } | |||||
| List<WxLegionActivityConfig> legionList = legionConfigMap.get(0L); | |||||
| activity.setLegionList(legionList); | |||||
| for(WxLegionActivityConfig legion : activity.getLegionList()){ | |||||
| legion.setUnionList(legionConfigMap.get(legion.getId())); | |||||
| legion.setMerchantList(merchantConfigMap.get(legion.getId())); | |||||
| } | |||||
| return activity; | |||||
| } | |||||
| @Override | |||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public void delMerchant(WxLegionActivity wxLegionActivity) { | |||||
| WxLegionActivityMerchantConfig merchantConfigQ = new WxLegionActivityMerchantConfig(); | |||||
| merchantConfigQ.updateTenantInfo(wxLegionActivity); | |||||
| merchantConfigQ.setActivityId(wxLegionActivity.getId()); | |||||
| merchantConfigQ.setIds(wxLegionActivity.getMerchantConfigIdList()); | |||||
| List<WxLegionActivityMerchantConfig> delList = wxLegionActivityMerchantConfigMapper.findList(merchantConfigQ); | |||||
| if(delList == null || delList.isEmpty()){ | |||||
| throw new MallinkException(Result.ERROR,"未查询到数据"); | |||||
| } | |||||
| List<Long> merchantIds = delList.stream().map(WxLegionActivityMerchantConfig::getMerchantId).collect(Collectors.toList()); | |||||
| wxLegionActivityMerchantConfigMapper.deleteByIds(merchantConfigQ); | |||||
| Date now = new Date(); | |||||
| WxLegionActivityUser activityUser = new WxLegionActivityUser(); | |||||
| activityUser.updateTenantInfo(wxLegionActivity); | |||||
| activityUser.setActivityId(wxLegionActivity.getId()); | |||||
| activityUser.setMerchantIdList(merchantIds); | |||||
| activityUser.setStatus(EnumLegionActivityUserStatus.INVALID.getCode()); | |||||
| activityUser.setUpdateDate(now); | |||||
| wxLegionActivityUserMapper.updateStatus(activityUser); | |||||
| WxLegionActivityOrder activityOrder = new WxLegionActivityOrder(); | |||||
| activityOrder.updateTenantInfo(wxLegionActivity); | |||||
| activityOrder.setActivityId(wxLegionActivity.getId()); | |||||
| activityOrder.setMerchantIdList(merchantIds); | |||||
| activityOrder.setAuditStatus(EnumLegionActivityOrderStatus.INVALID.getCode()); | |||||
| activityOrder.setUpdateDate(now); | |||||
| wxLegionActivityOrderMapper.updateAuditStatus(activityOrder); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,126 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.domain.po.WxLegionActivityMerchantConfig; | |||||
| import com.iformall.domain.po.WxLegionActivityOrder; | |||||
| import com.iformall.domain.po.WxLegionActivityUser; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.enums.EnumLegionActivityOrderStatus; | |||||
| import com.iformall.enums.EnumLegionActivityUserStatus; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxLegionActivityMerchantConfigMapper; | |||||
| import com.iformall.service.WxLegionActivityUserService; | |||||
| import com.iformall.mapper.WxLegionActivityUserMapper; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.*; | |||||
| import java.util.function.Function; | |||||
| import java.util.stream.Collectors; | |||||
| /** | |||||
| * @author xiaohu | |||||
| * @description 针对表【wx_legion_activity_user(军团活动用户)】的数据库操作Service实现 | |||||
| * @createDate 2024-08-23 21:31:17 | |||||
| */ | |||||
| @Service | |||||
| public class WxLegionActivityUserServiceImpl implements WxLegionActivityUserService{ | |||||
| @Autowired | |||||
| private WxLegionActivityUserMapper wxLegionActivityUserMapper; | |||||
| @Autowired | |||||
| private WxLegionActivityMerchantConfigMapper wxLegionActivityMerchantConfigMapper; | |||||
| @Override | |||||
| public PageInfo<WxLegionActivityUser> listAsPage(WxLegionActivityUser wxLegionActivityUser, Integer pageNum, Integer pageSize) { | |||||
| handlerQuery(wxLegionActivityUser); | |||||
| PageInfo<WxLegionActivityUser> recordPageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxLegionActivityUserMapper.findList(wxLegionActivityUser)); | |||||
| handlerList(recordPageInfo.getList()); | |||||
| return recordPageInfo; | |||||
| } | |||||
| private void handlerQuery(WxLegionActivityUser wxLegionActivityUser) { | |||||
| } | |||||
| private void handlerList(List<WxLegionActivityUser> wxLegionActivityUsers) { | |||||
| if(wxLegionActivityUsers == null || wxLegionActivityUsers.isEmpty()) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxLegionActivityUser wxLegionActivityUser) { | |||||
| WxLegionActivityUser userQ = new WxLegionActivityUser(); | |||||
| userQ.updateTenantInfo(wxLegionActivityUser); | |||||
| userQ.setActivityId(wxLegionActivityUser.getActivityId()); | |||||
| userQ.setPhone(wxLegionActivityUser.getPhone()); | |||||
| userQ.setStatus(EnumLegionActivityUserStatus.VALID.getCode()); | |||||
| WxLegionActivityUser user = this.selectOne(userQ); | |||||
| if(user != null) { | |||||
| if(wxLegionActivityUser.getId() == null){ | |||||
| throw new MallinkException(Result.ERROR,"该用户已绑定"); | |||||
| } | |||||
| if(!wxLegionActivityUser.getId().equals(user.getId())){ | |||||
| throw new MallinkException(Result.ERROR,"该用户已绑定"); | |||||
| } | |||||
| } | |||||
| WxLegionActivityMerchantConfig merchantConfigQuery = new WxLegionActivityMerchantConfig(); | |||||
| merchantConfigQuery.updateTenantInfo(wxLegionActivityUser); | |||||
| merchantConfigQuery.setActivityId(wxLegionActivityUser.getActivityId()); | |||||
| merchantConfigQuery.setMerchantId(wxLegionActivityUser.getMerchantId()); | |||||
| WxLegionActivityMerchantConfig merchantConfig = wxLegionActivityMerchantConfigMapper.selectOne(new QueryWrapper<>(merchantConfigQuery)); | |||||
| if(merchantConfig != null){ | |||||
| wxLegionActivityUser.setLegionId(merchantConfig.getLegionId()); | |||||
| wxLegionActivityUser.setUnionId(merchantConfig.getUnionId()); | |||||
| }else{ | |||||
| wxLegionActivityUser.setLegionId(0L); | |||||
| wxLegionActivityUser.setUnionId(0L); | |||||
| } | |||||
| Date now = new Date(); | |||||
| if(wxLegionActivityUser.getId() == null){ | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxLegionActivityUser.setId(idWorker.nextId()); | |||||
| wxLegionActivityUser.setCreateDate(now); | |||||
| wxLegionActivityUser.setUpdateDate(now); | |||||
| wxLegionActivityUser.setStatus(EnumLegionActivityUserStatus.VALID.getCode()); | |||||
| wxLegionActivityUserMapper.insert(wxLegionActivityUser); | |||||
| } | |||||
| else{ | |||||
| wxLegionActivityUser.setUpdateDate(now); | |||||
| wxLegionActivityUserMapper.updateById(wxLegionActivityUser); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public WxLegionActivityUser getById(Long id, String tenantId) { | |||||
| return wxLegionActivityUserMapper.selectById(id,tenantId); | |||||
| } | |||||
| @Override | |||||
| public WxLegionActivityUser selectOne(WxLegionActivityUser wxLegionActivityUser) { | |||||
| return wxLegionActivityUserMapper.selectOne(new QueryWrapper<>(wxLegionActivityUser)); | |||||
| } | |||||
| @Override | |||||
| public Map<Long, WxLegionActivityUser> findUserMap(WxLegionActivityUser wxLegionActivityUser) { | |||||
| Map<Long, WxLegionActivityUser> userMap = new HashMap<>(); | |||||
| List<WxLegionActivityUser> list = wxLegionActivityUserMapper.findList(wxLegionActivityUser); | |||||
| if(!list.isEmpty()){ | |||||
| userMap = list.stream().collect(Collectors.toMap(WxLegionActivityUser::getId, Function.identity())); | |||||
| } | |||||
| return userMap; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,109 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper | |||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxLegionActivityConfigMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityConfig"> | |||||
| <id property="id" column="id" jdbcType="BIGINT"/> | |||||
| <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="activityId" column="activity_id" jdbcType="BIGINT"/> | |||||
| <result property="parentId" column="parent_id" jdbcType="BIGINT"/> | |||||
| <result property="name" column="name" jdbcType="VARCHAR"/> | |||||
| <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/> | |||||
| <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| id,tenant_id,parent_tenant_id, | |||||
| activity_id,parent_id,`name`, | |||||
| create_date,update_date | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != parentId "> | |||||
| and `parent_id` = #{parentId} | |||||
| </if> | |||||
| <if test=" null != name and name != '' "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivityConfig" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity_config | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <delete id="deleteConfig" parameterType="java.util.HashMap"> | |||||
| delete from wx_legion_activity_config | |||||
| where `activity_id` = #{activityId} | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| </delete> | |||||
| <insert id="insertList" parameterType="java.util.List"> | |||||
| insert into wx_legion_activity_config | |||||
| (id, | |||||
| activity_id,parent_id,`name`, | |||||
| create_date,update_date) | |||||
| values | |||||
| <foreach collection="configList" item="item" index="index" separator=","> | |||||
| (#{item.id,jdbcType=BIGINT}, | |||||
| #{item.activityId,jdbcType=BIGINT},#{item.parentId,jdbcType=BIGINT},#{item.name,jdbcType=VARCHAR}, | |||||
| #{item.createDate,jdbcType=TIMESTAMP},#{item.updateDate,jdbcType=TIMESTAMP}) | |||||
| </foreach> | |||||
| </insert> | |||||
| <select id="findActivityCount" parameterType="com.iformall.domain.po.WxLegionActivityConfig" resultType="com.iformall.domain.vo.LegionActivityCount"> | |||||
| select activity_id as 'activityId', | |||||
| count(1) as 'count' | |||||
| from wx_legion_activity_config | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != parentId "> | |||||
| and `parent_id` = #{parentId} | |||||
| </if> | |||||
| <if test=" null != activityIdList "> | |||||
| and `activity_id` in | |||||
| <foreach collection="activityIdList" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| group by activity_id | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,115 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper | |||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxLegionActivityMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivity"> | |||||
| <id property="id" column="id" jdbcType="BIGINT"/> | |||||
| <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="name" column="name" jdbcType="VARCHAR"/> | |||||
| <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/> | |||||
| <result property="endTime" column="end_time" jdbcType="TIMESTAMP"/> | |||||
| <result property="sellingCard" column="selling_card" jdbcType="INTEGER"/> | |||||
| <result property="signOrder" column="sign_order" jdbcType="INTEGER"/> | |||||
| <result property="difLegionOrder" column="dif_legion_order" jdbcType="INTEGER"/> | |||||
| <result property="difUnionOrder" column="dif_union_order" jdbcType="INTEGER"/> | |||||
| <result property="eqUnionOrder" column="eq_union_order" jdbcType="INTEGER"/> | |||||
| <result property="notUnionOrder" column="not_union_order" jdbcType="INTEGER"/> | |||||
| <result property="status" column="status" jdbcType="SMALLINT"/> | |||||
| <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/> | |||||
| <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| id,tenant_id,parent_tenant_id, | |||||
| `name`,start_time,end_time, | |||||
| selling_card,sign_order,dif_legion_order, | |||||
| dif_union_order,eq_union_order,not_union_order, | |||||
| status,create_date,update_date | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != begin"> | |||||
| and `start_time` >= #{begin} | |||||
| </if> | |||||
| <if test=" null != end"> | |||||
| and `end_time` <= #{end} | |||||
| </if> | |||||
| <!-- 未过期 --> | |||||
| <if test=" 0 == validStatus"> | |||||
| and end_time >= now() | |||||
| </if> | |||||
| <!-- 已过期 --> | |||||
| <if test=" 1 == validStatus"> | |||||
| and end_time <= now() | |||||
| </if> | |||||
| <if test=" null != name and name != '' "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != statusList "> | |||||
| and `status` in | |||||
| <foreach collection="statusList" index="index" item="statusItem" open="(" separator="," close=")"> | |||||
| #{statusItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity where id = #{id} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivity" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="findIds" parameterType="com.iformall.domain.po.WxLegionActivity" resultType="Long"> | |||||
| select id from wx_legion_activity | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxLegionActivity"> | |||||
| update wx_legion_activity | |||||
| set `status` = #{status}, | |||||
| `update_date` = #{updateDate} | |||||
| where id=#{id} | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| </update> | |||||
| </mapper> | |||||
| @@ -0,0 +1,122 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper | |||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxLegionActivityMerchantConfigMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityMerchantConfig"> | |||||
| <id property="id" column="id" jdbcType="BIGINT"/> | |||||
| <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="activityId" column="activity_id" jdbcType="BIGINT"/> | |||||
| <result property="legionId" column="legion_id" jdbcType="BIGINT"/> | |||||
| <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/> | |||||
| <result property="unionId" column="union_id" jdbcType="BIGINT"/> | |||||
| <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/> | |||||
| <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| id,tenant_id,parent_tenant_id, | |||||
| activity_id,legion_id,merchant_id, | |||||
| union_id,create_date,update_date | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != legionId "> | |||||
| and `legion_id` = #{legionId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != unionId "> | |||||
| and `union_id` = #{unionId} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivityMerchantConfig" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity_merchant_config | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <delete id="deleteConfig" parameterType="java.util.HashMap"> | |||||
| delete from wx_legion_activity_merchant_config | |||||
| where `activity_id` = #{activityId} | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| </delete> | |||||
| <insert id="insertList" parameterType="java.util.List"> | |||||
| insert into wx_legion_activity_merchant_config | |||||
| (id, | |||||
| activity_id,legion_id,merchant_id, | |||||
| union_id,create_date,update_date) | |||||
| values | |||||
| <foreach collection="configList" item="item" index="index" separator=","> | |||||
| (#{item.id,jdbcType=BIGINT}, | |||||
| #{item.activityId,jdbcType=BIGINT},#{item.legionId,jdbcType=BIGINT},#{item.merchantId,jdbcType=BIGINT}, | |||||
| #{item.unionId,jdbcType=BIGINT},#{item.createDate,jdbcType=TIMESTAMP},#{item.updateDate,jdbcType=TIMESTAMP}) | |||||
| </foreach> | |||||
| </insert> | |||||
| <select id="findActivityCount" parameterType="com.iformall.domain.po.WxLegionActivityMerchantConfig" resultType="com.iformall.domain.vo.LegionActivityCount"> | |||||
| select activity_id as 'activityId', | |||||
| count(1) as 'count' | |||||
| from wx_legion_activity_merchant_config | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != activityIdList "> | |||||
| and `activity_id` in | |||||
| <foreach collection="activityIdList" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| group by activity_id | |||||
| </select> | |||||
| <delete id="deleteByIds" parameterType="com.iformall.domain.po.WxLegionActivityMerchantConfig"> | |||||
| delete from wx_legion_activity_merchant_config | |||||
| where `activity_id` = #{activityId} | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </delete> | |||||
| </mapper> | |||||
| @@ -0,0 +1,303 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper | |||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxLegionActivityOrderMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityOrder"> | |||||
| <id property="id" column="id" jdbcType="BIGINT"/> | |||||
| <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="activityId" column="activity_id" jdbcType="BIGINT"/> | |||||
| <result property="orderNo" column="order_no" jdbcType="VARCHAR"/> | |||||
| <result property="orderMoney" column="order_money" jdbcType="DECIMAL"/> | |||||
| <result property="cusId" column="cus_id" jdbcType="BIGINT"/> | |||||
| <result property="cusName" column="cus_name" jdbcType="VARCHAR"/> | |||||
| <result property="cusAddress" column="cus_address" jdbcType="VARCHAR"/> | |||||
| <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/> | |||||
| <result property="legionId" column="legion_id" jdbcType="BIGINT"/> | |||||
| <result property="unionId" column="union_id" jdbcType="BIGINT"/> | |||||
| <result property="orderType" column="order_type" jdbcType="SMALLINT"/> | |||||
| <result property="createBy" column="create_by" jdbcType="BIGINT"/> | |||||
| <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/> | |||||
| <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/> | |||||
| <result property="auditRemark" column="audit_remark" jdbcType="VARCHAR"/> | |||||
| <result property="auditStatus" column="audit_status" jdbcType="INTEGER"/> | |||||
| <result property="auditBy" column="audit_by" jdbcType="BIGINT"/> | |||||
| <result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| id,tenant_id,parent_tenant_id, | |||||
| activity_id,order_no,order_money, | |||||
| cus_id,cus_name,cus_address, | |||||
| merchant_id,legion_id,union_id, | |||||
| order_type,create_by,create_date, | |||||
| update_date,audit_remark,audit_status, | |||||
| audit_by,audit_time | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != orderNo and orderNo != '' "> | |||||
| and `order_no` like concat('%', #{orderNo},'%') | |||||
| </if> | |||||
| <if test=" null != cusId"> | |||||
| and `cus_id` = #{cusId} | |||||
| </if> | |||||
| <if test=" null != cusName and cusName != '' "> | |||||
| and `cus_name` like concat('%', #{cusName},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != legionId "> | |||||
| and `legion_id` = #{legionId} | |||||
| </if> | |||||
| <if test=" null != unionId "> | |||||
| and `union_id` = #{unionId} | |||||
| </if> | |||||
| <if test=" null != orderType "> | |||||
| and `order_type` = #{orderType} | |||||
| </if> | |||||
| <if test=" null != createDateBegin"> | |||||
| and `create_date` >= #{createDateBegin} | |||||
| </if> | |||||
| <if test=" null != createDateEnd"> | |||||
| and `create_date` <= #{createDateEnd} | |||||
| </if> | |||||
| <if test=" null != auditTimeBegin"> | |||||
| and `audit_time` >= #{auditTimeBegin} | |||||
| </if> | |||||
| <if test=" null != auditTimeEnd"> | |||||
| and `audit_time` <= #{auditTimeEnd} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and `audit_status` = #{auditStatus} | |||||
| </if> | |||||
| <if test=" null != orderTypeList "> | |||||
| and order_type in | |||||
| <foreach collection="orderTypeList" index="index" item="otyItem" open="(" separator="," close=")"> | |||||
| #{otyItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != cusIdList "> | |||||
| and cus_id in | |||||
| <foreach collection="cusIdList" index="index" item="cidItem" open="(" separator="," close=")"> | |||||
| #{cidItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != merchantIdList "> | |||||
| and merchant_id in | |||||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||||
| #{midItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity_order | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity_order where id = #{id} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <update id="updateAuditStatus" parameterType="com.iformall.domain.po.WxLegionActivityOrder"> | |||||
| update wx_legion_activity_order | |||||
| set `audit_status` = #{auditStatus}, | |||||
| <if test=" null != auditRemark and '' != auditRemark"> | |||||
| `audit_remark` = #{auditRemark}, | |||||
| </if> | |||||
| <if test=" null != auditTime"> | |||||
| `audit_time` = #{auditTime}, | |||||
| </if> | |||||
| <if test=" null != auditBy"> | |||||
| `audit_by` = #{auditBy}, | |||||
| </if> | |||||
| `update_date` = #{updateDate} | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != merchantIdList "> | |||||
| and merchant_id in | |||||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||||
| #{midItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </update> | |||||
| <select id="auditStatusStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderStatistics"> | |||||
| SELECT audit_status as 'auditStatus', | |||||
| count(1) as 'count' | |||||
| FROM wx_legion_activity_order | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != legionId "> | |||||
| and `legion_id` = #{legionId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != createDateBegin"> | |||||
| and `create_date` >= #{createDateBegin} | |||||
| </if> | |||||
| <if test=" null != createDateEnd"> | |||||
| and `create_date` <= #{createDateEnd} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and `audit_status` = #{auditStatus} | |||||
| </if> | |||||
| GROUP BY audit_status | |||||
| </select> | |||||
| <select id="orderTypeStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderTypeStatistics"> | |||||
| SELECT order_type as 'orderType', | |||||
| count(1) as 'count' | |||||
| FROM wx_legion_activity_order | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != legionId "> | |||||
| and `legion_id` = #{legionId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and `audit_status` = #{auditStatus} | |||||
| </if> | |||||
| GROUP BY order_type | |||||
| </select> | |||||
| <select id="merchantStatistics" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivityOrderTypeStatistics"> | |||||
| SELECT merchant_id as 'merchantId', | |||||
| order_type as 'orderType', | |||||
| count(1) as 'count' | |||||
| FROM wx_legion_activity_order | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != legionId "> | |||||
| and `legion_id` = #{legionId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and `audit_status` = #{auditStatus} | |||||
| </if> | |||||
| GROUP BY merchant_id,order_type | |||||
| </select> | |||||
| <select id="findOrderUser" parameterType="com.iformall.domain.po.WxLegionActivityOrder" resultType="com.iformall.domain.vo.LegionActivitySellOrder"> | |||||
| SELECT o.id as 'orderId', | |||||
| o.order_no as 'orderNo', | |||||
| o.order_money as 'orderMoney', | |||||
| o.merchant_id as 'orderMerchantId', | |||||
| o.legion_id as 'orderLegionId', | |||||
| o.union_id as 'orderUnionId', | |||||
| o.order_type as 'orderType', | |||||
| o.create_date as 'orderCreateDate', | |||||
| u.id as 'cusId', | |||||
| u.phone as 'cusPhone', | |||||
| u.vip_num as 'cusVipNum', | |||||
| u.merchant_id as 'cusMerchantId', | |||||
| u.legion_id as 'cusLegionId', | |||||
| u.union_id as 'cusUnionId', | |||||
| u.create_date as 'cusCreateDate' | |||||
| FROM wx_legion_activity_order o | |||||
| left join wx_legion_activity_user u on u.id = o.cus_id | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and o.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and o.`parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and o.`activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | |||||
| and o.`audit_status` = #{auditStatus} | |||||
| </if> | |||||
| <if test=" null != orderType "> | |||||
| and o.`order_type` = #{orderType} | |||||
| </if> | |||||
| <if test=" null != orderTypeList "> | |||||
| and o.order_type in | |||||
| <foreach collection="orderTypeList" index="index" item="otyItem" open="(" separator="," close=")"> | |||||
| #{otyItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -0,0 +1,167 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper | |||||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxLegionActivityUserMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLegionActivityUser"> | |||||
| <id property="id" column="id" jdbcType="BIGINT"/> | |||||
| <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/> | |||||
| <result property="activityId" column="activity_id" jdbcType="BIGINT"/> | |||||
| <result property="phone" column="phone" jdbcType="VARCHAR"/> | |||||
| <result property="name" column="name" jdbcType="VARCHAR"/> | |||||
| <result property="address" column="address" jdbcType="VARCHAR"/> | |||||
| <result property="vipNum" column="vip_num" jdbcType="VARCHAR"/> | |||||
| <result property="merchantId" column="merchant_id" jdbcType="BIGINT"/> | |||||
| <result property="legionId" column="legion_id" jdbcType="BIGINT"/> | |||||
| <result property="unionId" column="union_id" jdbcType="BIGINT"/> | |||||
| <result property="status" column="status" jdbcType="INTEGER"/> | |||||
| <result property="createBy" column="create_by" jdbcType="BIGINT"/> | |||||
| <result property="createDate" column="create_date" jdbcType="TIMESTAMP"/> | |||||
| <result property="updateDate" column="update_date" jdbcType="TIMESTAMP"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| id,tenant_id,parent_tenant_id, | |||||
| activity_id,phone,`name`, | |||||
| address,vip_num,merchant_id, | |||||
| legion_id,union_id,status,create_by, | |||||
| create_date,update_date | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != phone and phone != '' "> | |||||
| and `phone` like concat('%', #{phone},'%') | |||||
| </if> | |||||
| <if test=" null != name and name != '' "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != vipNum and vipNum != '' "> | |||||
| and `vip_num` like concat('%', #{vipNum},'%') | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != legionId "> | |||||
| and `legion_id` = #{legionId} | |||||
| </if> | |||||
| <if test=" null != unionId "> | |||||
| and `union_id` = #{unionId} | |||||
| </if> | |||||
| <if test=" null != createDateBegin"> | |||||
| and `create_date` >= #{createDateBegin} | |||||
| </if> | |||||
| <if test=" null != createDateEnd"> | |||||
| and `create_date` <= #{createDateEnd} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != merchantIdList "> | |||||
| and merchant_id in | |||||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||||
| #{midItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxLegionActivityUser" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity_user | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxLegionActivityUser" resultType="Long"> | |||||
| select id from wx_legion_activity_user | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_legion_activity_user where id = #{id} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <select id="merchantCountStatistics" parameterType="com.iformall.domain.po.WxLegionActivityUser" resultType="com.iformall.domain.vo.LegionActivityUserStatistics"> | |||||
| SELECT merchant_id as 'merchantId', | |||||
| count(1) as 'count' | |||||
| FROM wx_legion_activity_user | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != createDateBegin"> | |||||
| and `create_date` >= #{createDateBegin} | |||||
| </if> | |||||
| <if test=" null != createDateEnd"> | |||||
| and `create_date` <= #{createDateEnd} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| GROUP BY merchant_id | |||||
| </select> | |||||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxLegionActivityUser"> | |||||
| update wx_legion_activity_user | |||||
| set `status` = #{Status}, | |||||
| `update_date` = #{updateDate} | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != activityId "> | |||||
| and `activity_id` = #{activityId} | |||||
| </if> | |||||
| <if test=" null != merchantIdList "> | |||||
| and merchant_id in | |||||
| <foreach collection="merchantIdList" index="index" item="midItem" open="(" separator="," close=")"> | |||||
| #{midItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </update> | |||||
| </mapper> | |||||