k94314517
2025-05-19 cdd6551b190b981b807a3b95e9635c559ccc769d
server/service/src/main/java/com/doumee/service/business/impl/UnionChangeServiceImpl.java
@@ -32,12 +32,14 @@
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -694,10 +696,19 @@
    }
    @Autowired
    private RedisTemplate redisTemplate;// Redis操作类,对这个使用不熟悉的,可以参考前面的博客
    private static final String KEY_PREFIX = "unionchange:upload:";
    @Override
    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
    public void uploadBXD(UnionChangeBXDDTO unionChangeBXDDTO){
        try{
            if(Objects.nonNull(redisTemplate.opsForValue().get(KEY_PREFIX+unionChangeBXDDTO.getId()))){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请勿重复提交");
            };
            redisTemplate.opsForValue().set(KEY_PREFIX+unionChangeBXDDTO.getId(), unionChangeBXDDTO.getId(), 30000, TimeUnit.SECONDS);
        if(Objects.isNull(unionChangeBXDDTO)
            || Objects.isNull(unionChangeBXDDTO.getId())
                || Objects.isNull(unionChangeBXDDTO.getApplyDate())
@@ -797,49 +808,7 @@
            
        }
        //存储合并单保险单
       /* Multifile multifile = new Multifile();
        multifile.setIsdeleted(Constants.ZERO);
        multifile.setCreator(user.getId());
        multifile.setCreateDate(new Date());
        multifile.setObjId(unionChangeBXDDTO.getId());
        multifile.setCreateDate(new Date());
        multifile.setObjType(Constants.MultiFile.WTB_CA_DONE_PDF.getKey());
        multifile.setType(Constants.TWO);
        multifile.setFileurl(unionChangeBXDDTO.getFileurl());
        multifile.setName(unionChangeBXDDTO.getName());
        multifileMapper.insert(multifile);*/
 
//        if(CollectionUtils.isNotEmpty(unionChangeBXDDTO.getApplyChangeBXDList())){
//            //查询是否不存在当前合并单的数据
//            if(applyChangeJoinMapper.selectCount(new QueryWrapper<ApplyChange>()
//                    .lambda().ne(ApplyChange::getUnionChangeId,unionChangeBXDDTO.getId())
//                    .in(ApplyChange::getId,
//                            unionChangeBXDDTO.getApplyChangeBXDList().stream().map(m->m.getObjId()).collect(Collectors.toList())
//                    )
//            )>Constants.ZERO){
//                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"批单明细记录存在非本合并单数据");
//            };
//            for (Multifile m:unionChangeBXDDTO.getApplyChangeBXDList()) {
//                if(StringUtils.isBlank(m.getName())
//                        || StringUtils.isBlank(m.getFileurl()) ){
//                    continue;
//                }
//                if(Objects.isNull(m.getObjId())
//                        ||StringUtils.isBlank(m.getFileurl())
//                        ||StringUtils.isBlank(m.getName())
//                ){
//                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"批单文件信息缺失");
//                }
//                m.setId(null);
//                m.setIsdeleted(Constants.ZERO);
//                m.setCreator(user.getId());
//                m.setCreateDate(new Date());
//                m.setObjType(Constants.MultiFile.CA_PD_PDF.getKey());
//                m.setType(Constants.TWO);
//                multifileMapper.insert(m);
//            }
//        }
        if(CollectionUtils.isNotEmpty(applyChangeList)){
            for (ApplyChange applyChange:applyChangeList) {
                ApplyChange oldModel = applyChange;
@@ -903,6 +872,11 @@
                ,unionChange.getId(),applyLogType.getKey(),null, JSONObject.toJSONString(unionChange));
        applyLogMapper.insert(log);
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            redisTemplate.delete(KEY_PREFIX + unionChangeBXDDTO.getId());
        }
    }