|
@@ -1,13 +1,25 @@
|
|
|
package com.ruoyi.finance.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.finance.domain.TFee;
|
|
|
+import com.ruoyi.finance.domain.TFeeDo;
|
|
|
+import com.ruoyi.finance.domain.TWareHouseFees;
|
|
|
import com.ruoyi.finance.service.ITFeeService;
|
|
|
import com.ruoyi.warehouse.mapper.TFeeMapper;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TEnclosure;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsfees;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
|
|
|
+import com.ruoyi.warehouseBusiness.service.impl.BillnoSerialServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 财务数据主Service业务层处理
|
|
@@ -20,6 +32,12 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
@Autowired
|
|
|
private TFeeMapper tFeeMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private com.ruoyi.warehouse.mapper.TFeeDoMapper tFeeDoMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BillnoSerialServiceImpl billnoSerialServiceImpl;
|
|
|
+
|
|
|
/**
|
|
|
* 查询财务数据主
|
|
|
*
|
|
@@ -55,6 +73,50 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 新增对账 、收费、
|
|
|
+ * @param tfee
|
|
|
+ * @param tfeeDo
|
|
|
+ * @param loginUser
|
|
|
+ * @param fBilltype
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult insertTFeeTFeeDo(String tfee, String tfeeDo, LoginUser loginUser, String fBilltype) {
|
|
|
+ Long fPid = null;
|
|
|
+ TFee tFee = JSONArray.parseObject(tfee, TFee.class);
|
|
|
+ if (StringUtils.isNull(tFee.getfId())) {
|
|
|
+ // 如果是新数据
|
|
|
+ tFee.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ tFee.setfBilltype(fBilltype);
|
|
|
+ // 业务编码
|
|
|
+ Date time = new Date();
|
|
|
+ String billNo = billnoSerialServiceImpl.getBillNo(fBilltype, time);
|
|
|
+ tFee.setfBillno(billNo);
|
|
|
+ tFeeMapper.insertTFee(tFee);
|
|
|
+ fPid = tFee.getfId();
|
|
|
+ } else {
|
|
|
+ fPid = tFee.getfId();
|
|
|
+ tFee.setUpdateBy(loginUser.getUser().getUserName());
|
|
|
+ tFee.setUpdateTime(new Date());
|
|
|
+ tFeeMapper.updateTFee(tFee);
|
|
|
+ // 删除从表
|
|
|
+ tFeeDoMapper.deleteByFPid(fPid);
|
|
|
+ }
|
|
|
+ // 财务从表
|
|
|
+ if (StringUtils.isNotNull(tfeeDo)) {
|
|
|
+ JSONArray jsonDrArray = JSONArray.parseArray(tfeeDo);
|
|
|
+ List<TFeeDo> tFeeDoList = JSONObject.parseArray(jsonDrArray.toJSONString(), TFeeDo.class);
|
|
|
+ for (TFeeDo tFeeDo : tFeeDoList) {
|
|
|
+ tFeeDo.setfPid(fPid);
|
|
|
+ tFeeDo.setCreateBy(loginUser.getUser().getUserName());
|
|
|
+ tFeeDo.setCreateTime(new Date());
|
|
|
+ tFeeDoMapper.insertTFeeDo(tFeeDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 修改财务数据主
|
|
|
*
|
|
|
* @param tFee 财务数据主
|
|
@@ -87,4 +149,20 @@ public class TFeeServiceImpl implements ITFeeService {
|
|
|
public int deleteTFeeById(Long fId) {
|
|
|
return tFeeMapper.deleteTFeeById(fId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> warehouseBillsFeesList(TWareHouseFees tWareHouseFees) {
|
|
|
+ // 获取费用list
|
|
|
+ List<Long> feeIdList =new ArrayList<Long>();
|
|
|
+ if(tWareHouseFees.getfFeeid() != null ){
|
|
|
+ List<String> lis = Arrays.asList(tWareHouseFees.getfFeeid().split(","));
|
|
|
+ for (String string : lis) {
|
|
|
+ feeIdList.add(Long.parseLong(string));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("feeIdList", feeIdList);
|
|
|
+ map.put("tWareHouseFees", tWareHouseFees);
|
|
|
+ return tFeeMapper.warehouseBillsFeesList(map);
|
|
|
+ }
|
|
|
}
|