developrelease_toaliyun_real
| @@ -43,9 +43,6 @@ public class InvestBaseController extends BaseController { | |||
| return new InvestResultData(r); | |||
| } catch (MallinkException e) { | |||
| log.error("execute error", e); | |||
| if (Objects.equals(Result.SUCCESS, e.getErrorCode())) { | |||
| return new InvestResultData(); | |||
| } | |||
| return new InvestResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (NullPointerException e) { | |||
| ErrorCode errorCode = ErrorCode.SYS_NULLPOINTER_ERROR ; | |||
| @@ -66,11 +63,17 @@ public class InvestBaseController extends BaseController { | |||
| } | |||
| } | |||
| public <T> void importData(T t, Consumer<T> action) { | |||
| public <T> InvestResultData importData(T t, Consumer<T> action) { | |||
| try { | |||
| log.debug("[" + getIpAddr() + "] request , params : {}", JSON.toJSONString(t)); | |||
| InvestUserContext.setUser(getUser()); | |||
| action.accept(t); | |||
| return new InvestResultData(); | |||
| } catch (MallinkException e) { | |||
| if (Objects.equals(Result.SUCCESS, e.getErrorCode())) { | |||
| return new InvestResultData(Result.SUCCESS, e.getMessage()); | |||
| } | |||
| throw e; | |||
| } finally { | |||
| InvestUserContext.remove(); | |||
| } | |||
| @@ -86,12 +86,12 @@ public class InvestCustomerController extends InvestBaseController{ | |||
| return execute(customerDto, p -> investBizService.updateCustomerAndDemand(p)); | |||
| } | |||
| @ApiOperation("导出客户信息") | |||
| @GetMapping("/exportCustomer") | |||
| @SystemControllerLog(description = "招商管理-导出客户信息") | |||
| public void exportCustomer(InvestDemandQuery params, HttpServletResponse response) { | |||
| exportData(params, response, (p, u) -> investBizService.exportCustomer(p, u)); | |||
| } | |||
| //@ApiOperation("导出客户信息") | |||
| //@GetMapping("/exportCustomer") | |||
| //@SystemControllerLog(description = "招商管理-导出客户信息") | |||
| //public void exportCustomer(InvestDemandQuery params, HttpServletResponse response) { | |||
| // exportData(params, response, (p, u) -> investBizService.exportCustomer(p, u)); | |||
| //} | |||
| @ApiOperation("导出客户信息模板") | |||
| @GetMapping("/exportCustomerTemplate") | |||
| @@ -103,8 +103,8 @@ public class InvestCustomerController extends InvestBaseController{ | |||
| @ApiOperation("导入客户信息" ) | |||
| @PostMapping(value = "/importCustomer", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @SystemControllerLog(description = "招商管理-导入客户信息") | |||
| public void importCustomer(@RequestParam("file") MultipartFile file) { | |||
| importData(file, p -> investBizService.importCustomer(p)); | |||
| public InvestResultData importCustomer(@RequestParam("file") MultipartFile file) { | |||
| return importData(file, p -> investBizService.importCustomer(p)); | |||
| } | |||
| } | |||
| @@ -56,6 +56,17 @@ public class WxFlowAbleController extends BaseController { | |||
| return wxFlowService.list(flowType,pageNum,pageSize,getUserId(),getTenantId()); | |||
| } | |||
| /** | |||
| * 待办总数 | |||
| */ | |||
| @ApiOperation("待办总数") | |||
| @GetMapping(value = "/getTotal") | |||
| @SystemControllerLog(description = "工作流-待办总数") | |||
| public ResultData getTotal() { | |||
| logger.debug("[" + getIpAddr() + "] FlowAbleController::getTotal"); | |||
| return wxFlowService.getTotal(getUserId(), getTenantId()); | |||
| } | |||
| /** | |||
| * 我的申请列表 | |||
| */ | |||
| @@ -143,6 +143,9 @@ public class TableOperateAspect { | |||
| for (Field field : fields) { | |||
| String annotationVal = field.getAnnotation(LogColumn.class).value(); | |||
| Object value = FieldUtils.readDeclaredField(entity, field.getName(), true); | |||
| if(Objects.isNull(value)) { | |||
| continue; | |||
| } | |||
| if (field.getType().isEnum()) { | |||
| value = InvestHelper.getEnumVal(InvestHelper.valueOf(value.getClass(), ((Enum) value).name())); | |||
| } | |||
| @@ -5,7 +5,6 @@ import com.iformall.domain.po.invest.InvestCustomerEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import java.util.Date; | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| @@ -6,7 +6,7 @@ import com.iformall.domain.po.WxFlowConfig; | |||
| import com.iformall.domain.po.WxFlowModel; | |||
| import com.iformall.domain.po.WxFlowRecord; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -125,4 +125,7 @@ public interface WxFlowService { | |||
| * @return | |||
| */ | |||
| List<WxFlowModel> getModelBybusiness(WxFlowModel wxFlowModel); | |||
| ResultData getTotal(Long userId, String tenantId); | |||
| } | |||
| @@ -967,7 +967,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillRent.setUpdatetime(updateDate); | |||
| if (oldLatePrice != null) { | |||
| wxBillRent.setLatePayPrice(newLatePrice); | |||
| wxBillRent.setOwe(newPrice + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); | |||
| wxBillRent.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); | |||
| wxBillRentMapper.updateById(wxBillRent); | |||
| addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); | |||
| } else { | |||
| @@ -1022,7 +1022,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| wxBillProperty.setUpdatetime(updateDate); | |||
| if (oldLatePrice != null) { | |||
| wxBillProperty.setLatePayPrice(newLatePrice); | |||
| wxBillProperty.setOwe(newPrice + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); | |||
| wxBillProperty.setOwe(dbBill.getReceivePay() + dbBill.getServiceChargePay() + newLatePrice - dbBill.getPay()); | |||
| wxBillPropertyMapper.updateById(wxBillProperty); | |||
| addBillAction(EnumBillAction.UPDATE_LATE_PAY_MONEY, id, oldLatePrice, newLatePrice, user); | |||
| } else { | |||
| @@ -1542,6 +1542,13 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| return wxFlowModelMapper.getModelBybusiness(wxFlowModel); | |||
| } | |||
| @Override | |||
| public ResultData getTotal(Long userId, String tenantId) { | |||
| TaskQuery taskQuery = taskService.createTaskQuery(); | |||
| int total = taskQuery.taskCandidateOrAssigned(userId.toString()).list().size(); | |||
| return new ResultData(total); | |||
| } | |||
| public static void main(String[] args) { | |||
| new Thread(() -> System.out.println(1 + "hello world")).start(); | |||
| @@ -184,8 +184,8 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| targetFile.mkdirs(); | |||
| } | |||
| String fileName = "invest_1.xlsx"; | |||
| //int dot = mFile.getOriginalFilename().lastIndexOf('.'); | |||
| //fileName = fileName + mFile.getOriginalFilename().substring(dot); | |||
| int dot = mFile.getOriginalFilename().lastIndexOf('.'); | |||
| fileName = fileName + mFile.getOriginalFilename().substring(dot); | |||
| File lFile = new File(fpath + File.separator + fileName); | |||
| @@ -256,7 +256,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| log.error(e.getMessage()); | |||
| // 删除缓存文件 | |||
| file.delete(); | |||
| return; | |||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "导入模板失败: 模板数据解析失败"); | |||
| } | |||
| // 删除缓存文件 | |||
| file.delete(); | |||
| @@ -264,7 +264,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| if (datalist == null) { | |||
| log.error("导入模板失败: 模板数据解析失败"); | |||
| setRedisValue(importKey, "1", "0", "0", "1", true); | |||
| return; | |||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "导入模板失败: 模板数据解析失败"); | |||
| } | |||
| List<InvestCustomerVo> successList = datalist.getList(); | |||
| @@ -280,6 +280,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| //添加到redis里 | |||
| setRedisValue(importKey, "" + total, "" + all_success, "0", "" + all_fail, total == all_fail); | |||
| if (CollectionUtils.isEmpty(successList)) { | |||
| stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); | |||
| return; | |||
| } | |||
| //品牌信息 | |||
| @@ -300,8 +301,15 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| List<InvestCustomerEntity> customers = customerService.list(customerQuery); | |||
| Map<String, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getPhone); | |||
| //商铺信息 | |||
| LambdaQueryWrapper<InvestDemandEntity> demandQuery = new LambdaQueryWrapper<>(); | |||
| Collection<Long> customerIds = getIds(customers, InvestCustomerEntity::getId); | |||
| demandQuery.in(CollectionUtils.isNotEmpty(customerIds), InvestDemandEntity::getCustomerId, customerIds); | |||
| List<InvestDemandEntity> demandList = demandService.list(demandQuery); | |||
| Map<Long, InvestDemandEntity> demandMap = getMap(demandList, InvestDemandEntity::getCustomerId); | |||
| try { | |||
| successList.parallelStream().forEach(customer -> { | |||
| successList.forEach(customer -> { | |||
| if (StringUtils.isBlank(customer.getPhone())) { | |||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | |||
| log.error("负责人电话为空", customer.toString()); | |||
| @@ -327,17 +335,25 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| log.error("经营业态为空", customer.toString()); | |||
| return; | |||
| } | |||
| InvestDemandDto customerBase = convetCustomer(customer, brandMap, businesseMap, shopMap, customerMap); | |||
| if (customerBase == null) { | |||
| InvestDemandDto toImportCustomer = convetCustomer(customer, brandMap, businesseMap, shopMap, customerMap.get(customer.getPhone()), demandMap); | |||
| if (toImportCustomer == null) { | |||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | |||
| log.error("customerBase null"); | |||
| return; | |||
| } | |||
| if (Objects.isNull(customerMap.get(customer.getPhone()))) { | |||
| saveCustomerAndDemand(toImportCustomer); | |||
| } else { | |||
| toImportCustomer.getCustomer().setId(customerMap.get(customer.getPhone()).getId()); | |||
| updateCustomerAndDemand(toImportCustomer); | |||
| } | |||
| saveCustomerAndDemand(customerBase) ; | |||
| }); | |||
| } catch (Exception e) { | |||
| setRedisValue(importKey, "1", "0", "0", "1", true); | |||
| e.printStackTrace(); | |||
| log.error("导入模板失败:" + e.getMessage()); | |||
| log.error("导入模板失败", e); | |||
| throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "导入模板失败"); | |||
| } finally { | |||
| stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); | |||
| } | |||
| } | |||
| @@ -351,30 +367,42 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| return getMap(brands, WxBrand::getName); | |||
| } | |||
| private InvestDemandDto convetCustomer(InvestCustomerVo customerVoT, Map<String, WxBrand> brandMap, Map<String, WxBusiness> businesseMap, Map<String, WxShop> shopMap, Map<String, InvestCustomerEntity> customerMap) { | |||
| InvestCustomerEntity customerEntity = new InvestCustomerEntity(); | |||
| if (Objects.isNull(brandMap.get(customerVoT.getBrandName()))) { | |||
| private InvestDemandDto convetCustomer(InvestCustomerVo importCustomerVo, Map<String, WxBrand> brandMap, Map<String, WxBusiness> businesseMap, Map<String, WxShop> shopMap, InvestCustomerEntity dbCustomer, Map<Long, InvestDemandEntity> demandMap) { | |||
| InvestCustomerEntity customerEntity = null; | |||
| InvestDemandEntity demandEntity = null; | |||
| if (Objects.isNull(dbCustomer)) { | |||
| customerEntity = new InvestCustomerEntity(); | |||
| } else { | |||
| customerEntity = dbCustomer; | |||
| demandEntity = demandMap.get(dbCustomer.getId()); | |||
| } | |||
| if (Objects.isNull(demandEntity)) { | |||
| demandEntity = new InvestDemandEntity(); | |||
| } | |||
| if (Objects.isNull(brandMap.get(importCustomerVo.getBrandName()))) { | |||
| return null; | |||
| } | |||
| customerEntity.setBrandId(brandMap.get(customerVoT.getBrandName()).getId()); | |||
| customerEntity.setBrandId(brandMap.get(importCustomerVo.getBrandName()).getId()); | |||
| if (Objects.isNull(businesseMap.get(customerVoT.getBusiness()))) { | |||
| if (Objects.isNull(businesseMap.get(importCustomerVo.getBusiness()))) { | |||
| return null; | |||
| } | |||
| customerEntity.setBusinessId(businesseMap.get(customerVoT.getBusiness()).getId()); | |||
| customerEntity.setBusinessId(businesseMap.get(importCustomerVo.getBusiness()).getId()); | |||
| InvestDemandEntity demandEntity = new InvestDemandEntity(); | |||
| if (Objects.isNull(shopMap.get(customerVoT.getShopNumber()))) { | |||
| if (Objects.isNull(shopMap.get(importCustomerVo.getShopNumber()))) { | |||
| return null; | |||
| } | |||
| demandEntity.setTargetId(shopMap.get(customerVoT.getShopNumber()).getId()); | |||
| customerEntity.setName(importCustomerVo.getName()); | |||
| customerEntity.setPhone(importCustomerVo.getPhone()); | |||
| customerEntity.setType(importCustomerVo.getType()); | |||
| demandEntity.setTargetId(shopMap.get(importCustomerVo.getShopNumber()).getId()); | |||
| demandEntity.setTargetType(EnumInvestType.RENT); | |||
| Map<String, Object> intent = new HashMap<>(); | |||
| if (Objects.nonNull(customerVoT.getRentArea())) { | |||
| intent.put(InvestDemandEntity.KEY_RENT_AREA, customerVoT.getRentArea()); | |||
| if (Objects.nonNull(importCustomerVo.getRentArea())) { | |||
| intent.put(InvestDemandEntity.KEY_RENT_AREA, importCustomerVo.getRentArea()); | |||
| } | |||
| if (Objects.nonNull(customerVoT.getOpeningTime())) { | |||
| intent.put(InvestDemandEntity.KEY_OPENING_TIME, customerVoT.getOpeningTime()); | |||
| if (Objects.nonNull(importCustomerVo.getOpeningTime())) { | |||
| intent.put(InvestDemandEntity.KEY_OPENING_TIME, importCustomerVo.getOpeningTime()); | |||
| } | |||
| if (!intent.isEmpty()) { | |||
| @@ -384,12 +412,6 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| InvestDemandDto demandDto = new InvestDemandDto(); | |||
| demandDto.setCustomer(customerEntity); | |||
| demandDto.setDemand(demandEntity); | |||
| if (Objects.isNull(customerMap.get(customerVoT.getPhone()))) { | |||
| //TODO insert | |||
| } else { | |||
| //TODO update | |||
| } | |||
| return demandDto; | |||
| } | |||
| @@ -399,7 +421,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| stringRedisTemplate.opsForHash().put(importKey, "processCount", processCount); | |||
| stringRedisTemplate.opsForHash().put(importKey, "failCount", failCount); | |||
| if (fail) { | |||
| stringRedisTemplate.expire(importKey, 10, TimeUnit.SECONDS); | |||
| stringRedisTemplate.expire(importKey, 3, TimeUnit.SECONDS); | |||
| } | |||
| } | |||
| @@ -719,7 +741,12 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| if (Objects.isNull(demandEntity.getCustomerId())) { | |||
| demandEntity.setCustomerId(customerId); | |||
| } | |||
| demandService.updateById(demandEntity); | |||
| InvestDemandEntity dbDemand = demandService.getByCustomerId(customerId); | |||
| if (Objects.isNull(dbDemand)) { | |||
| demandService.save(demandEntity); | |||
| } else { | |||
| demandService.updateById(demandEntity); | |||
| } | |||
| saveMessage(demandEntity, demandDto.getCustomer()); | |||
| return true; | |||
| } | |||
| @@ -730,7 +757,7 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| } | |||
| Long owner = demandEntity.getOwner(); | |||
| if (Objects.nonNull(owner) && !Objects.equals(owner, 0L)) { | |||
| List<Long> ownerArray = Arrays.asList(owner); | |||
| List<Long> ownerArray = Collections.singletonList(owner); | |||
| demandService.saveBatchMessage(ownerArray, EnumInvestMessageType.CUSTOMER_CREATE.getInfo(), EnumInvestMessageTag.CUSTOMER_CREATE, EnumFollowType.DEMAND, customerEntity.getId()); | |||
| } | |||
| } | |||
| @@ -1124,6 +1151,9 @@ public class InvestBizServiceImpl implements InvestBizService { | |||
| } | |||
| private <T, R> Collection<R> getIds(Collection<T> dataList, Function<? super T, R> mapper) { | |||
| if (CollectionUtils.isEmpty(dataList)) { | |||
| return Collections.emptyList(); | |||
| } | |||
| return InvestHelper.getIds(dataList, mapper); | |||
| } | |||
| } | |||
| @@ -6,10 +6,12 @@ import com.iformall.common.TableLog; | |||
| import com.iformall.domain.po.invest.InvestCustomerEntity; | |||
| import com.iformall.domain.vo.invest.InvestCustomerVo; | |||
| import com.iformall.enums.EnumCustomerType; | |||
| import com.iformall.enums.EnumInvestChannel; | |||
| import com.iformall.mapper.InvestCustomerMapper; | |||
| import com.iformall.service.WxBrandService; | |||
| import com.iformall.service.WxBusinessService; | |||
| import com.iformall.service.invest.InvestCustomerService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @@ -33,6 +35,7 @@ public class InvestCustomerServiceImpl extends InvestBaseServiceImpl<InvestCusto | |||
| return super.saveAction(entity, this::checkBeforeSaveOrUpdate); | |||
| } | |||
| @TableLog | |||
| @Override | |||
| public boolean update(InvestCustomerEntity entity, Wrapper<InvestCustomerEntity> updateWrapper) { | |||
| return super.updateActon(entity, updateWrapper, this::checkBeforeSaveOrUpdate); | |||
| @@ -48,10 +51,13 @@ public class InvestCustomerServiceImpl extends InvestBaseServiceImpl<InvestCusto | |||
| private void checkBeforeSaveOrUpdate(InvestCustomerEntity entity) { | |||
| checkBusiness(businessService, entity.getBusinessId()); | |||
| checkBrand(brandService, entity.getBrandId()); | |||
| checkType(entity); | |||
| //checkType(entity); | |||
| if (Objects.isNull(entity.getBrandId())) { | |||
| entity.setBrandId(0L); | |||
| } | |||
| if (StringUtils.isBlank(entity.getInvestChannel())) { | |||
| entity.setInvestChannel(EnumInvestChannel.NONE.getInfo()); | |||
| } | |||
| } | |||
| /** | |||
| @@ -424,47 +424,61 @@ | |||
| </update> | |||
| <select id="userTradeList" parameterType="com.iformall.domain.po.WxMerchant" resultType="com.iformall.domain.vo.WxMerchantTradeVo"> | |||
| select m.id,m.`img_url` cover,m.`name` merchantName,m.`link_person` linkName, | |||
| (select count(*) from wx_coupon_order o | |||
| left join wx_coupon co on(o.`coupon_id`=co.id) | |||
| left join wx_coupon_merchant cm on(cm.product_id=co.id) | |||
| inner join wx_merchant_b_user mb on(mb.id=o.b_user_id) | |||
| where cm.`merchant_id`=m.id and o.coupon_order_status=1 and mb.merchant_id=m.id | |||
| <if test="starttime != null"> | |||
| and o.create_date >= #{starttime} | |||
| </if> | |||
| <if test="endtime != null"> | |||
| and o.create_date <= #{endtime} | |||
| </if> | |||
| ) consumeCount, | |||
| (select count(distinct mb.id) from wx_coupon_order o | |||
| left join wx_coupon co on(o.`coupon_id`=co.id) | |||
| left join wx_coupon_merchant cm on(cm.product_id=co.id) | |||
| inner join wx_merchant_b_user mb on(mb.id=o.b_user_id) | |||
| where cm.`merchant_id`=m.id and o.coupon_order_status=1 and mb.merchant_id=m.id | |||
| <if test="starttime != null"> | |||
| and o.create_date >= #{starttime} | |||
| </if> | |||
| <if test="endtime != null"> | |||
| and o.create_date <= #{endtime} | |||
| </if> | |||
| ) consumeCountP, | |||
| IFNULL((select sum(co.price) from wx_coupon_order o | |||
| left join wx_coupon co on(o.`coupon_id`=co.id) | |||
| left join wx_coupon_merchant cm on(cm.product_id=co.id) | |||
| inner join wx_merchant_b_user mb on(mb.id=o.b_user_id) | |||
| where cm.`merchant_id`=m.id and o.coupon_order_status=1 and mb.merchant_id=m.id | |||
| SELECT m.id, m.`img_url` cover, m.`name` merchantName, m.`link_person` linkName, | |||
| ifnull(consume.consumeCount,0) consumeCount,ifnull(consumePeople.consumeCountP,0) as consumeCountP, | |||
| ifnull(price.tradeAmt,0) tradeAmt | |||
| FROM wx_merchant m | |||
| left join (SELECT count(*) as consumeCount,cm.merchant_id FROM wx_coupon_order o | |||
| LEFT JOIN wx_coupon co ON (o.`coupon_id` = co.id) | |||
| LEFT JOIN wx_coupon_merchant cm ON (cm.product_id = co.id) | |||
| WHERE o.coupon_order_status = 1 | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test="starttime != null"> | |||
| and o.create_date >= #{starttime} | |||
| </if> | |||
| <if test="endtime != null"> | |||
| and o.create_date <= #{endtime} | |||
| </if> | |||
| group by cm.merchant_id | |||
| ) consume on consume.merchant_id=m.id | |||
| left join (SELECT count(DISTINCT o.c_user_id) as consumeCountP,cm.merchant_id FROM wx_coupon_order o | |||
| LEFT JOIN wx_coupon co ON (o.`coupon_id` = co.id) | |||
| LEFT JOIN wx_coupon_merchant cm ON (cm.product_id = co.id) | |||
| WHERE o.coupon_order_status = 1 | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test="starttime != null"> | |||
| and o.create_date >= #{starttime} | |||
| </if> | |||
| <if test="endtime != null"> | |||
| and o.create_date <= #{endtime} | |||
| </if> | |||
| group by cm.merchant_id | |||
| ) consumePeople on consumePeople.merchant_id=m.id | |||
| left join (SELECT sum(o.coupon_price) as tradeAmt,cm.merchant_id FROM wx_coupon_order o | |||
| LEFT JOIN wx_coupon co ON (o.`coupon_id` = co.id) | |||
| LEFT JOIN wx_coupon_merchant cm ON (cm.product_id = co.id) | |||
| INNER JOIN wx_merchant_b_user mb ON (mb.id = o.b_user_id) | |||
| WHERE o.coupon_order_status = 1 | |||
| <if test="tenantId != null"> | |||
| and o.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test="starttime != null"> | |||
| and o.create_date >= #{starttime} | |||
| </if> | |||
| <if test="endtime != null"> | |||
| and o.create_date <= #{endtime} | |||
| </if> | |||
| ),0) tradeAmt | |||
| from wx_merchant m where m.status=1 | |||
| group by cm.merchant_id | |||
| ) price on price.merchant_id=m.id | |||
| where m.status=1 | |||
| <if test=" null != name and ''!=name "> | |||
| and `name` like concat('%', #{name},'%') | |||