|  | @@ -426,6 +426,10 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |      public AjaxResult insertKHTFeeTFeeDo(String tfee, String tfeeDo, String tFeeInvoice, LoginUser loginUser, String fBilltype) {
 | 
	
		
			
				|  |  |          Long fPid = null;
 | 
	
		
			
				|  |  |          Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | +        String billStatus = "2";
 | 
	
		
			
				|  |  | +        if (fBilltype.equals("INV")){
 | 
	
		
			
				|  |  | +            billStatus = "6";
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          TFee tFee = JSONArray.parseObject(tfee, TFee.class);
 | 
	
		
			
				|  |  |          if (StringUtils.isNull(tFee.getfId())) {
 | 
	
		
			
				|  |  |              // 如果是新数据
 | 
	
	
		
			
				|  | @@ -437,13 +441,13 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |              Date time = new Date();
 | 
	
		
			
				|  |  |              String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
 | 
	
		
			
				|  |  |              tFee.setfBillno(billNo);
 | 
	
		
			
				|  |  | -            tFee.setfBillstatus("2");
 | 
	
		
			
				|  |  | +            tFee.setfBillstatus(billStatus);
 | 
	
		
			
				|  |  |              tFeeMapper.insertTFee(tFee);
 | 
	
		
			
				|  |  |              fPid = tFee.getfId();
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              fPid = tFee.getfId();
 | 
	
		
			
				|  |  |              boolean change = this.change(fPid);
 | 
	
		
			
				|  |  | -            if (!change) {
 | 
	
		
			
				|  |  | +            if (!change && !"INV".equals(fBilltype)) {
 | 
	
		
			
				|  |  |                  return AjaxResult.error("当前数据不支持修改");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              tFee.setUpdateBy(loginUser.getUser().getUserName());
 | 
	
	
		
			
				|  | @@ -461,7 +465,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |                  tFeeDo.setfPid(fPid);
 | 
	
		
			
				|  |  |                  tFeeDo.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |                  tFeeDo.setCreateTime(new Date());
 | 
	
		
			
				|  |  | -                tFeeDo.setfStatus("2");
 | 
	
		
			
				|  |  | +                tFeeDo.setfStatus(billStatus);
 | 
	
		
			
				|  |  |                  tFeeDoMapper.insertTFeeDo(tFeeDo);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -472,7 +476,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |                  feeInvoice.setfPid(fPid);
 | 
	
		
			
				|  |  |                  feeInvoice.setCreateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |                  feeInvoice.setCreateTime(new Date());
 | 
	
		
			
				|  |  | -                feeInvoice.setfBillstatus("2");
 | 
	
		
			
				|  |  | +                feeInvoice.setfBillstatus(billStatus);
 | 
	
		
			
				|  |  |                  tFeeInvoiceMapper.insertTFeeInvoice(feeInvoice);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -729,6 +733,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  |      public AjaxResult webVersionConfirm(Long[] fIds, String billsType, LoginUser loginUser) {
 | 
	
		
			
				|  |  |          String key = "";
 | 
	
		
			
				|  |  |          boolean isApprove = false;
 | 
	
	
		
			
				|  | @@ -827,6 +832,7 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  |      public AjaxResult confirmKaiHe(String tfee, String tfeeDo, String tFeeInvoice, LoginUser loginUser, String fBilltype) {
 | 
	
		
			
				|  |  |          Long fPid = null;
 | 
	
		
			
				|  |  |          TFee tFee = JSONArray.parseObject(tfee, TFee.class);
 | 
	
	
		
			
				|  | @@ -1047,6 +1053,12 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |      public AjaxResult revoke(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
 | 
	
		
			
				|  |  |          // 更新 主表、从表
 | 
	
		
			
				|  |  |          TFee tFee = JSONArray.parseObject(tfee, TFee.class);
 | 
	
		
			
				|  |  | +        if("DZApplyFP".equals(fBilltype)){
 | 
	
		
			
				|  |  | +            TFee fee = tFeeMapper.selectTFeeById(tFee.getfId());
 | 
	
		
			
				|  |  | +            if (fee.getfMake()==1){
 | 
	
		
			
				|  |  | +                return AjaxResult.error("该申请发票已开销项发票,不能撤销");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          tFee.setUpdateBy(loginUser.getUser().getUserName());
 | 
	
		
			
				|  |  |          tFee.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |          tFeeMapper.updateTFee(tFee);
 | 
	
	
		
			
				|  | @@ -1082,6 +1094,8 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |              return AjaxResult.success("0");
 | 
	
		
			
				|  |  |          } else if (StringUtils.isNotNull(tFee) && StringUtils.isEmpty(tFeeDoList)) {
 | 
	
		
			
				|  |  |              return AjaxResult.success("1");
 | 
	
		
			
				|  |  | +        }else if (tFee.getfBilltype().equals("INV") && tFee.getfAccountId() !=null) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success("3");
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              return AjaxResult.success("2");
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -1532,5 +1546,58 @@ public class TFeeServiceImpl implements ITFeeService {
 | 
	
		
			
				|  |  |          return map;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 申请发票审核成功复制数据到销项发票中
 | 
	
		
			
				|  |  | +     * @param fId  主表id
 | 
	
		
			
				|  |  | +     * @param fBilltype  类型
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  | +    public AjaxResult copyInvoiceFp(Long fId,String fBilltype){
 | 
	
		
			
				|  |  | +        //查询费用主表信息复制主表信息
 | 
	
		
			
				|  |  | +        Integer insert = null;
 | 
	
		
			
				|  |  | +        TFee fee = tFeeMapper.selectTFeeById(fId);
 | 
	
		
			
				|  |  | +        TFee tFee = new TFee();
 | 
	
		
			
				|  |  | +        tFee.setfId(fee.getfId());
 | 
	
		
			
				|  |  | +        Date time = new Date();
 | 
	
		
			
				|  |  | +        String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
 | 
	
		
			
				|  |  | +        //查询费用从表信息复制主表信息
 | 
	
		
			
				|  |  | +        fee.setfAccountId(fee.getfId());
 | 
	
		
			
				|  |  | +        fee.setfBillno(billNo);
 | 
	
		
			
				|  |  | +        fee.setfBilltype(fBilltype);
 | 
	
		
			
				|  |  | +        fee.setfId(null);
 | 
	
		
			
				|  |  | +        insert = tFeeMapper.insertTFee(fee);
 | 
	
		
			
				|  |  | +        tFee.setfMake(1);
 | 
	
		
			
				|  |  | +        //修改原发票数据代表已开销项发票
 | 
	
		
			
				|  |  | +        insert = tFeeMapper.updateTFee(tFee);
 | 
	
		
			
				|  |  | +        TFeeDo tFeeDo = new TFeeDo();
 | 
	
		
			
				|  |  | +        tFeeDo.setfPid(fId);
 | 
	
		
			
				|  |  | +        List<TFeeDo> tFeeDoList = tFeeDoMapper.selectTFeeDoList(tFeeDo);
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(tFeeDoList)){
 | 
	
		
			
				|  |  | +            for (TFeeDo feeDo : tFeeDoList) {
 | 
	
		
			
				|  |  | +                feeDo.setfId(null);
 | 
	
		
			
				|  |  | +                feeDo.setfPid(fee.getfId());
 | 
	
		
			
				|  |  | +                feeDo.setfBilltype(fBilltype);
 | 
	
		
			
				|  |  | +                insert = tFeeDoMapper.insertTFeeDo(feeDo);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        //查询开票信息复制主表信息
 | 
	
		
			
				|  |  | +        TFeeInvoice tFeeInvoice = new TFeeInvoice();
 | 
	
		
			
				|  |  | +        tFeeInvoice.setfPid(fId);
 | 
	
		
			
				|  |  | +        List<TFeeInvoice> tFeeInvoiceList = tFeeInvoiceMapper.selectTFeeInvoiceList(tFeeInvoice);
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(tFeeInvoiceList)){
 | 
	
		
			
				|  |  | +            for (TFeeInvoice invoice : tFeeInvoiceList) {
 | 
	
		
			
				|  |  | +                invoice.setfId(null);
 | 
	
		
			
				|  |  | +                invoice.setfPid(fee.getfId());
 | 
	
		
			
				|  |  | +                insert = tFeeInvoiceMapper.insertTFeeInvoice(invoice);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (insert != null && insert >0){
 | 
	
		
			
				|  |  | +            return AjaxResult.success();
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("生成销项发票失败,请找管理员");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |