CZT
2023-11-27 c206acfaedc69c390fb67daa81bc686f58a212ef
igds-manager/src/main/java/com/ld/igds/m/service/HFinanceService.java
@@ -8,6 +8,7 @@
import com.ld.igds.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.Session;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
@@ -28,22 +29,22 @@
      String companyId = ContextUtil.getCompanyId();
      String hql = " from " + AssetsLiability.class.getName()
            + " where companyId =:companyId and deptId =:deptId";
            + " where companyId =:companyId";
      Map<String, Object> args = new HashMap<String, Object>();
      args.put("companyId", companyId);
      args.put("deptId", ContextUtil.subDeptId(null));
      if (null != param) {
         String str = (String) param.get("customerId");
         if (StringUtils.isNotEmpty(str)) {
            hql += " and customerId like:customerId";
            args.put("customerId", "%" + str + "%");
         Date date = (Date) param.get("start");
         if (null != date) {
            hql += " and bbsj >=:start";
            args.put("start", DateUtil.getCurZero(date));
         }
         str = (String) param.get("customerName");
         if (StringUtils.isNotEmpty(str)) {
            hql += " and customerName like:customerName";
            args.put("customerName", "%" + str + "%");
         date = (Date) param.get("end");
         if (null != date) {
            hql += " and bbsj <=:end";
            args.put("end", DateUtil.getNextZero(date));
         }
      }
@@ -52,16 +53,18 @@
      return this.query(hql, args);
   }
   public String saveAssetsData(AssetsLiability data) {
   public String saveAssetsData(AssetsLiability oldData) {
      Session session = this.getSessionFactory().openSession();
      try {
         AssetsLiability data = new AssetsLiability();
         BeanUtils.copyProperties(oldData, data);
         if(StringUtils.isEmpty(data.getCompanyId())){
            data.setCompanyId(ContextUtil.getCompanyId());
         }
         if(StringUtils.isEmpty(data.getDeptId())){
            data.setDeptId(ContextUtil.subDeptId(null));
         }
         data.setZhgxsj(new Date());
         if (StringUtils.isEmpty(data.getId())) {
            data.setId(ContextUtil.getCurTimeMillis());
@@ -93,14 +96,11 @@
   public List<CashFlow> getCashFlowData(Map<String, Object> param){
      String companyId = ContextUtil.getCompanyId();
      String hql = " from " + AssetsLiability.class.getName()
            + " where companyId =:companyId and deptId =:deptId";
      String hql = " from " + CashFlow.class.getName()
            + " where companyId =:companyId";
      Map<String, Object> args = new HashMap<String, Object>();
      args.put("companyId", companyId);
      args.put("deptId", ContextUtil.subDeptId(null));
      args.put("companyId", ContextUtil.getCompanyId());
      if(null != param){
         Date date = (Date) param.get("start");
@@ -121,16 +121,18 @@
      return this.query(hql, args);
   }
   public String saveCashFlowData(CashFlow data) {
   public String saveCashFlowData(CashFlow oldData) {
      Session session = this.getSessionFactory().openSession();
      try {
         CashFlow data = new CashFlow();
         BeanUtils.copyProperties(oldData, data);
         if(StringUtils.isEmpty(data.getCompanyId())){
            data.setCompanyId(ContextUtil.getCompanyId());
         }
         if(StringUtils.isEmpty(data.getDeptId())){
            data.setDeptId(ContextUtil.subDeptId(null));
         }
         data.setZhgxsj(new Date());
         if (StringUtils.isEmpty(data.getId())) {
            data.setId(ContextUtil.getCurTimeMillis());
@@ -162,14 +164,11 @@
   public List<Profit> getProfitData(Map<String, Object> param){
      String companyId = ContextUtil.getCompanyId();
      String hql = " from " + Profit.class.getName()
            + " where companyId =:companyId and deptId =:deptId";
            + " where companyId =:companyId";
      Map<String, Object> args = new HashMap<String, Object>();
      args.put("companyId", companyId);
      args.put("deptId", ContextUtil.subDeptId(null));
      args.put("companyId", ContextUtil.getCompanyId());
      if(null != param){
         Date date = (Date) param.get("start");
@@ -190,17 +189,18 @@
      return this.query(hql, args);
   }
   public String saveProfitData(Profit data) {
   public String saveProfitData(Profit oldData) {
      Session session = this.getSessionFactory().openSession();
      try {
         Profit data = new Profit();
         BeanUtils.copyProperties(oldData, data);
         if(StringUtils.isEmpty(data.getCompanyId())){
            data.setCompanyId(ContextUtil.getCompanyId());
         }
         if(StringUtils.isEmpty(data.getDeptId())){
            data.setDeptId(ContextUtil.subDeptId(null));
         }
         data.setZhgxsj(new Date());
         if (StringUtils.isEmpty(data.getId())) {
            data.setId(ContextUtil.getCurTimeMillis());
            session.save(data);