|  | @@ -23,6 +23,8 @@ import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.interceptor.TransactionAspectSupport;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
	
		
			
				|  | @@ -59,6 +61,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private TWarehousebillsfeesMapper tWarehousebillsfeesMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询财务数据主
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -290,6 +293,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  |      public AjaxResult confirm(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
 | 
	
		
			
				|  |  |          // 更新 主表、从表
 | 
	
		
			
				|  |  |          TFee tFee = JSONArray.parseObject(tfee, TFee.class);
 | 
	
	
		
			
				|  | @@ -307,38 +311,68 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |                  tFeeDo.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |                  tFeeDo.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                  tFeeDoMapper.insertTFeeDo(tFeeDo);
 | 
	
		
			
				|  |  | +                // 跟新费用明细
 | 
	
		
			
				|  |  | +                int m = updateBillsFees(tFee.getfId(),tFeeDo,fBilltype);
 | 
	
		
			
				|  |  | +                if (m == 0) {
 | 
	
		
			
				|  |  | +                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                    return AjaxResult.error("更新费用明细失败");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // 更新费用明细
 | 
	
		
			
				|  |  | -        updateBillsFees(tFee.getfId(),fBilltype);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          // 审批流程
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        return AjaxResult.success();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return null;
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  | +    public AjaxResult revoke(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
 | 
	
		
			
				|  |  | +        // 更新 主表、从表
 | 
	
		
			
				|  |  | +        TFee tFee = JSONArray.parseObject(tfee, TFee.class);
 | 
	
		
			
				|  |  | +        tFee.setUpdateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  | +        tFee.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | +        tFeeMapper.updateTFee(tFee);
 | 
	
		
			
				|  |  | +        // 删除从表
 | 
	
		
			
				|  |  | +        tFeeDoMapper.deleteByFPid(tFee.getfId());
 | 
	
		
			
				|  |  | +        //  财务从表
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotNull(tfeeDo)) {
 | 
	
		
			
				|  |  | +            JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
 | 
	
		
			
				|  |  | +            List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
 | 
	
		
			
				|  |  | +            for (TFeeDo tFeeDo : tFeeDoList) {
 | 
	
		
			
				|  |  | +                tFeeDo.setfPid(tFee.getfId());
 | 
	
		
			
				|  |  | +                tFeeDo.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  | +                tFeeDo.setCreateTime(new Date());
 | 
	
		
			
				|  |  | +                tFeeDoMapper.insertTFeeDo(tFeeDo);
 | 
	
		
			
				|  |  | +                // 跟新费用明细
 | 
	
		
			
				|  |  | +                int m = updateBillsFees(tFee.getfId(),tFeeDo,fBilltype);
 | 
	
		
			
				|  |  | +                if (m == 0) {
 | 
	
		
			
				|  |  | +                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 | 
	
		
			
				|  |  | +                    return AjaxResult.error("更新费用明细失败");
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return AjaxResult.success();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public  void  updateBillsFees(Long fid,String billsType){
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     *  更新费用明细
 | 
	
		
			
				|  |  | +     * @param fid
 | 
	
		
			
				|  |  | +     * @param tFeeDo
 | 
	
		
			
				|  |  | +     * @param billsType
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  | +    public  int  updateBillsFees(Long fid,TFeeDo tFeeDo,String billsType){
 | 
	
		
			
				|  |  |          // 查询从表数据
 | 
	
		
			
				|  |  |          TFee tFee=tFeeMapper.selectTFeeById(fid);
 | 
	
		
			
				|  |  | -        TFeeDo tFeeDo = new TFeeDo();
 | 
	
		
			
				|  |  | -        tFeeDo.setfPid(fid);
 | 
	
		
			
				|  |  | -        List<TFeeDo> tFeeDoList=  tFeeDoMapper.selectTFeeDoList(tFeeDo);
 | 
	
		
			
				|  |  | -        // 更新费用明细
 | 
	
		
			
				|  |  | -        for (TFeeDo tFeeDo1 : tFeeDoList ){
 | 
	
		
			
				|  |  | -            // 查询仓库费用明细表数据
 | 
	
		
			
				|  |  | -            TWarehousebillsfees tWarehousebillsfees=new TWarehousebillsfees();
 | 
	
		
			
				|  |  | -            tWarehousebillsfees.setfId(tFeeDo1.getfSrcid());
 | 
	
		
			
				|  |  | -            if(billsType.equals("DZ")){
 | 
	
		
			
				|  |  | -                tWarehousebillsfees.setfStatementNo(tFee.getfBillno());
 | 
	
		
			
				|  |  | -                tWarehousebillsfees.setfAccamountDate(tFee.getfAccbilldate());
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                tWarehousebillsfees.setfStlamountNo(tFee.getfBillno());
 | 
	
		
			
				|  |  | -                // tWarehousebillsfees.setfStlamount();
 | 
	
		
			
				|  |  | -                tWarehousebillsfees.setfStlamountDate(tFee.getfAccbilldate());
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +        if(billsType.equals("SF") || billsType.equals("FF")){
 | 
	
		
			
				|  |  | +            billsType="DC";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +        map.put("tFee", tFee);
 | 
	
		
			
				|  |  | +        map.put("billType", billsType);
 | 
	
		
			
				|  |  | +        map.put("tFeeDo", tFeeDo);
 | 
	
		
			
				|  |  | +        return tWarehousebillsfeesMapper.updateTWarehousebillsfee(map);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |