diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 6351f55..8779723 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -50,12 +50,9 @@ spring: url: jdbc:mysql://erp9.52o.site:13308/erp20241208?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: erp20241208 password: a2aLeLYbzfZY4MZH -# url: jdbc:mysql://erp.52o.site:13306/erp20241128?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true -# username: erp20241128 -# password: 74SenGey6GAKkFRx -# url: jdbc:mysql://erp.52o.site:13306/erp2024?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true -# username: erp2024 -# password: h7DJsL8jF3WDz4JS +# url: jdbc:mysql://erp9.52o.site:13308/sjzxerp-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +# username: sjzxerp-test +# password: EYpxAtdHmzHrTNGL # 从库数据源 slave: lazy: false diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index 4cea4bc..de7ea04 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -53,9 +53,9 @@ spring: url: jdbc:mysql://erp9.52o.site:13308/erp20241208?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: erp20241208 password: a2aLeLYbzfZY4MZH -# url: jdbc:mysql://erp.52o.site:13306/erp20241128?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true -# username: erp20241128 -# password: 74SenGey6GAKkFRx +# url: jdbc:mysql://erp9.52o.site:13308/sjzxerp-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +# username: sjzxerp-test +# password: EYpxAtdHmzHrTNGL # 从库数据源 slave: lazy: false diff --git a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java index 165c89f..3d42056 100644 --- a/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-work/src/main/java/org/dromara/work/service/impl/TpNewOrderServiceImpl.java @@ -100,7 +100,26 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl buildKHRankingMPJWrapper(OrderRankingBo bo) { + LoginUser loginUser = LoginHelper.getLoginUser(); MPJLambdaWrapper lqw = new MPJLambdaWrapper<>(); + + if(bo.getDeptIds()!= null && bo.getDeptIds().size() > 0){ + lqw.in(TpOrder::getDeptId,bo.getDeptIds()); + }else { + int scope = getDataScope(); + if(scope == 2){ + List deptIds = getDeptIds(); + lqw.in(TpOrder::getDeptId,deptIds); + }else if(scope == 3){ + lqw.eq(TpOrder::getDeptId,loginUser.getDeptId()); + }else if(scope == 4){ + List deptIds = deptMapper.selectList(new LambdaQueryWrapper().like(SysDept::getAncestors, loginUser.getDeptId())).stream().map(SysDept::getDeptId).collect(Collectors.toList()); + deptIds.add(loginUser.getDeptId()); + lqw.in(TpOrder::getDeptId,deptIds); + }else if(scope == 5){ + lqw.eq(TpOrder::getSid,loginUser.getUserId()); + } + } lqw.eq(StringUtils.isNotBlank(bo.getUserName()), TpClient::getCode, bo.getUserName()); lqw.eq(StringUtils.isNotBlank(bo.getRealName()), TpClient::getName, bo.getRealName()); lqw.between(bo.getStartTime() != null && bo.getEndTime() != null, @@ -279,7 +298,15 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl().eq(TpClient::getIsDel, 1)); +// Long totalNum = clientMapper.selectCount(new LambdaQueryWrapper().eq(TpClient::getIsDel, 1)); + + // 统计下单客户数量(去重) + MPJLambdaWrapper lqw = buildKHRankingMPJWrapper(bo) + .selectAs("count(t.sid)", OrderRankingSumVo::getTotalNum) + .leftJoin(TpClient.class, TpClient::getId, TpOrder::getKid) + .groupBy(TpOrder::getKid); + List list = baseMapper.selectJoinList(OrderRankingSumVo.class, lqw); + MPJLambdaWrapper wrapper = buildKHRankingMPJWrapper(bo) .selectAs("count(1)",OrderRankingSumVo::getTotalOrderNum) .selectAs("sum(t.price)",OrderRankingSumVo::getTotalPerformance) @@ -290,7 +317,7 @@ public class TpNewOrderServiceImpl extends MPJBaseServiceImpl 0){ order.setGpay(getGjPayPrice(order.getPrice(),newPayPrice,order.getGjPrice())); } - order.setJsPayPrice(getJsPayPrice(order.getPrice(),newPayPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()))); + BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),newPayPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice())); + order.setJsPayPrice(getJsPay(jsPayPrice)); order.setState(2); order.setPayPrice(newPayPrice); BigDecimal endPrice = order.getPrice().subtract(newPayPrice); @@ -863,7 +864,8 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl 0){ order.setGpay(getGjPayPrice(order.getPrice(),payPrice,order.getGjPrice())); } - order.setJsPayPrice(getJsPayPrice(order.getPrice(),payPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice()))); + BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),payPrice,order.getPrice().subtract(order.getGjPrice()).subtract(order.getCdPrice())); + order.setJsPayPrice(getJsPay(jsPayPrice)); order.setPayPrice(payPrice); return baseMapper.updateById(order); @@ -911,7 +913,8 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl 0){ order.setGpay(getGjPayPrice(order.getPrice(),order.getPayPrice(),order.getGjPrice())); } - order.setJsPayPrice(getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getGjPrice()).subtract(price))); + BigDecimal jsPayPrice = getJsPayPrice(order.getPrice(),order.getPayPrice(),order.getPrice().subtract(order.getGjPrice()).subtract(price)); + order.setJsPayPrice(getJsPay(jsPayPrice)); } boolean res = saveOrderRecord(order.getId(),"订单拆单","订单:"+order.getOrderId()+"拆单成功!拆单金额:"+price,1,null); if(!res){ @@ -954,7 +957,8 @@ public class TpOrderServiceImpl extends MPJBaseServiceImpl f.getPrice()).reduce(BigDecimal.ZERO, BigDecimal::add)); - QueryWrapper lqwo = new QueryWrapper<>(); + /*QueryWrapper lqwo = new QueryWrapper<>(); lqwo.select("COUNT(DISTINCT kid) as count"); String idsStr = ids.stream().map(f -> f.toString()).collect(Collectors.joining(",")); lqwo.inSql("wid", idsStr); Map result = orderMapper.selectMaps(lqwo).get(0); Long cjkhSum = (Long) result.get("count"); + wechatSumVo.setCjkhSum(cjkhSum);*/ + + QueryWrapper lqwo = new QueryWrapper<>(); + lqwo.select("COUNT(DISTINCT kid) as count"); + lqwo.in("wid", ids); + Map result = orderMapper.selectMaps(lqwo).get(0); + Long cjkhSum = (Long) result.get("count"); wechatSumVo.setCjkhSum(cjkhSum); } - LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(); + /*LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(); lqw1.inSql(bo.getUid() != null,TpWechatNum::getWid,"SELECT id FROM tp_wechat as w WHERE w.is_del = 1 and w.uid = "+bo.getUid()); lqw1.geSql(TpWechatNum::getAddTime,"CONCAT( YEAR ( CURDATE()), '-01-01' )"); + Long yearNum = wechatNumMapper.selectList(lqw1).stream().mapToLong(TpWechatNum::getNum).sum();*/ + + LambdaQueryWrapper lqw1 = new LambdaQueryWrapper<>(); + lqw1.in(TpWechatNum::getWid,ids); + lqw1.geSql(TpWechatNum::getAddTime,"CONCAT( YEAR ( CURRENT_DATE ()), '-01-01' )"); Long yearNum = wechatNumMapper.selectList(lqw1).stream().mapToLong(TpWechatNum::getNum).sum(); + /*LambdaQueryWrapper lqw2 = new LambdaQueryWrapper<>(); + lqw2.inSql(bo.getUid() != null,TpWechatNum::getWid,"SELECT id FROM tp_wechat as w WHERE w.is_del = 1 and w.uid = "+bo.getUid()); + lqw2.geSql(TpWechatNum::getAddTime,"CONCAT( YEAR ( CURRENT_DATE ()), '-', MONTH ( CURRENT_DATE ()), '-01' )"); + Long monthNum = wechatNumMapper.selectList(lqw2).stream().mapToLong(TpWechatNum::getNum).sum();*/ LambdaQueryWrapper lqw2 = new LambdaQueryWrapper<>(); - lqw2.inSql(bo.getUid() != null,TpWechatNum::getWid,"SELECT id FROM tp_wechat as w WHERE w.is_del = 1 and w.uid = "+bo.getUid()); + lqw2.in(TpWechatNum::getWid,ids); lqw2.geSql(TpWechatNum::getAddTime,"CONCAT( YEAR ( CURRENT_DATE ()), '-', MONTH ( CURRENT_DATE ()), '-01' )"); Long monthNum = wechatNumMapper.selectList(lqw2).stream().mapToLong(TpWechatNum::getNum).sum(); - LambdaQueryWrapper lqw3 = new LambdaQueryWrapper<>(); + /*LambdaQueryWrapper lqw3 = new LambdaQueryWrapper<>(); lqw3.inSql(bo.getUid() != null,TpWechatNum::getWid,"SELECT id FROM tp_wechat as w WHERE w.is_del = 1 and w.uid = "+bo.getUid()); lqw3.geSql(TpWechatNum::getAddTime,"( CURDATE() - INTERVAL 1 DAY )"); - Long dayNum = wechatNumMapper.selectList(lqw3).stream().mapToLong(TpWechatNum::getNum).sum(); + Long dayNum = wechatNumMapper.selectList(lqw3).stream().mapToLong(TpWechatNum::getNum).sum();*/ + LambdaQueryWrapper lqw3 = new LambdaQueryWrapper<>(); + lqw3.in(TpWechatNum::getWid,ids); + lqw3.geSql(TpWechatNum::getAddTime,"( CURDATE() - INTERVAL 1 DAY )"); + Long dayNum = wechatNumMapper.selectList(lqw3).stream().mapToLong(TpWechatNum::getNum).sum(); wechatSumVo.setBnxzSum(yearNum); wechatSumVo.setByxzSum(monthNum);