lige
2024-01-24 a2d12d52275c9fc34277d3e41c662a5ea9fb597f
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjFlowingWaterController.java
@@ -7,6 +7,7 @@
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.common.utils.SecurityUtils;
@@ -205,7 +206,7 @@
        TjOrder order = orderService.getById(tjFlowingWater.getOrderId());
        TjCustomer customer = customerService.getById(order.getUserId());
        if (null != tjFlowingWater.getTjProIds() && tjFlowingWater.getTjProIds().length > 0) {
            tjFlowingWater.setWaterId(SecurityUtils.getUsername() + DateUtil.format(new Date(), "yyMMddHHmmssSSS"));
            tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(customer.getCusName(), "").toUpperCase() + DateUtil.format(new Date(), "yyMMddHHmmssSSS"));
            tjFlowingWater.setIsAddition("Y");
            if (tjFlowingWaterService.save(tjFlowingWater)) {
                //异步单项收费明细
@@ -418,7 +419,7 @@
                                tjRefundVo.setTjName(MatchUtils.hideCusName(customer.getCusName()));
                                tjRefundVo.setTjPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                                tjRefundVo.setSex(String.valueOf(customer.getCusSex()));
                                tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                               if(null !=customer.getCusIdcard()) tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                                DictComp dictComp = compService.getById(order.getFirmId());
                                if(null !=dictComp){
                                    tjRefundVo.setTjComp(dictComp.getCnName());
@@ -498,8 +499,12 @@
                            tjRefundVo.setTjPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                            tjRefundVo.setSex(String.valueOf(customer.getCusSex()));
                            tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                            if (null != order.getDictCompName())
                                tjRefundVo.setTjComp(compService.getById(order.getFirmId()) != null ? compService.getById(order.getFirmId()).getCnName() : null);
                            if (null != order.getFirmId()){
                                DictComp byId = compService.getById(order.getFirmId());
                                if(null != byId){
                                    tjRefundVo.setTjComp(byId.getCnName());
                                }
                            }
                            if (null != order.getTjType()) tjRefundVo.setTjType(order.getTjType());
                            TjFlowingWater one = tjFlowingWaterService.getOne(new LambdaQueryWrapper<TjFlowingWater>()
                                    .eq(TjFlowingWater::getOrderId, order.getOrderId())
@@ -539,18 +544,36 @@
                if (null != tjProjectList && tjProjectList.size() > 0) {
                    for (TjProject project : tjProjectList) {
                        if (project.getProParentId() == 0) {
                            LambdaQueryWrapper<TbTransition> wqq1 = new LambdaQueryWrapper<>();
                            wqq1.eq(TbTransition::getCusId, customerService.getById(order.getUserId()).getCusIdcard());
                            wqq1.eq(TbTransition::getParentProId, project.getProId());
                            List<TbTransition> tbTransitionList = transitionService.list(wqq1);
                            BigDecimal bigDecimal = new BigDecimal("0.00");
                            BigDecimal bigDecimal1 = new BigDecimal("0.00");
                            for (TbTransition transition : tbTransitionList) {
                                 bigDecimal = bigDecimal.add(transition.getNowPrice());
                                 bigDecimal1=bigDecimal1.add(transition.getOrdPrice());
                            //LambdaQueryWrapper<TbTransition> wqq1 = new LambdaQueryWrapper<>();
//                            wqq1.eq(TbTransition::getCusId, customerService.getById(order.getUserId()).getCusIdcard());
//                            wqq1.eq(TbTransition::getParentProId, project.getProId());
//                            List<TbTransition> tbTransitionList = transitionService.list(wqq1);
//                            BigDecimal bigDecimal = new BigDecimal("0.00");
//                            BigDecimal bigDecimal1 = new BigDecimal("0.00");
//                            for (TbTransition transition : tbTransitionList) {
//                                 bigDecimal = bigDecimal.add(transition.getNowPrice());
//                                 bigDecimal1=bigDecimal1.add(transition.getOrdPrice());
//                            }
//                            project.setProPrice(bigDecimal.setScale(0,BigDecimal.ROUND_UP));
//                            project.setProOrdPrice(bigDecimal1);
                            BigDecimal decimal = transitionService.getTbTransitionPriceAndOrdPrice(customerService.getById(order.getUserId()).getCusIdcard(),
                                    project.getProId());
                            String s = tjFlowingWaterService.getDiscount(OrderId);
                            if(null !=decimal){
//                                project.setProPrice(decimal.setScale(2));
                                project.setProPrice(decimal);
//                                project.setProOrdPrice(decimal.multiply(new BigDecimal(s)).setScale(2));
                                project.setProOrdPrice(decimal);
                            }else {
                                BigDecimal decimal1 = transitionService.getTbTransitionDxPriceAndOrdPrice(String.valueOf(order.getUserId()),project.getProId());
                                if(null !=decimal1){
                                    project.setProPrice(decimal1.setScale(2));
                                    project.setProOrdPrice(decimal1.multiply(new BigDecimal(s)).setScale(2));
                                }else {
                                    project.setProPrice(new BigDecimal("0.00").setScale(2));
                                    project.setProOrdPrice(new BigDecimal("0.00").setScale(2));
                                }
                            }
                            project.setProPrice(bigDecimal.setScale(0,BigDecimal.ROUND_UP));
                            project.setProOrdPrice(bigDecimal1);
                        }
                    }
                }