zjh
2024-12-07 148a7f11b0ead8539cae824f02dda19a703f4d0b
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjFlowingWaterController.java
@@ -9,6 +9,7 @@
import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.annotation.RepeatSubmit;
import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.common.utils.SecurityUtils;
import com.ltkj.framework.config.MatchUtils;
@@ -23,6 +24,7 @@
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import com.ltkj.common.annotation.Log;
import com.ltkj.common.core.controller.BaseController;
@@ -91,7 +93,7 @@
        LambdaQueryWrapper<TjChargingStandard> wq3 = new LambdaQueryWrapper<>();
        wq3.eq(TjChargingStandard::getTjNum, TjNumber);
        List<TjChargingStandard> list = chargingStandardService.list(wq3);
        if (null != list && list.size() > 0) {
        if (null != list && !list.isEmpty()) {
            for (TjChargingStandard standard : list) {
                TjProject project = projectService.getById(standard.getProId());
                if (null != project && null != project.getProCheckType()) {
@@ -197,21 +199,34 @@
    @PutMapping
    @ApiOperation(value = "体检点击收费按钮接口")
    @Transactional
    @RepeatSubmit
    public AjaxResult edit(@RequestBody TjFlowingWater tjFlowingWater) {
        Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId());
        SysUser sysUser = userService.getById(userId);
        TjFlowingWater flowingWater = tjFlowingWaterService.getById(tjFlowingWater.getTjSerialNumber());
        tjFlowingWater.setTollCollectorId(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
        tjFlowingWater.setPayStasus(1L);
//        tjFlowingWater.setTollCollectorId(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
//        tjFlowingWater.setPayStasus(1L);
        TjOrder order = orderService.getById(tjFlowingWater.getOrderId());
        if(order.getFinishTime() !=null){
            return AjaxResult.error("该人员已签离,不可补录项目!");
        }
        TjCustomer customer = customerService.getById(order.getUserId());
        if (null != tjFlowingWater.getTjProIds() && tjFlowingWater.getTjProIds().length > 0) {
            tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(customer.getCusName(), "").toUpperCase() + DateUtil.format(new Date(), "yyMMddHHmmssSSS"));
            tjFlowingWater.setWaterId(PinyinUtil.getFirstLetter(customer.getCusName(), "").toUpperCase() +SecurityUtils.getUsername() + DateUtil.format(new Date(), "yyMMddHHmmssSSS"));
            tjFlowingWater.setIsAddition("Y");
            if (tjFlowingWaterService.save(tjFlowingWater)) {
                //异步单项收费明细
                asyncService.iundividualCharges(tjFlowingWater, order, customer, sysUser);
                Boolean b = asyncService.iundividualCharges(tjFlowingWater, order, customer, sysUser);
                if (!b){
                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    return AjaxResult.error();
                }
//                if(!b){
//                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
//                }
                //extracted(tjFlowingWater, order, customer);
                Map<String, Object> map = new HashMap<>();
                map.put("waterId", tjFlowingWater.getWaterId());