| | |
| | | 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; |
| | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | |
| | | 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()); |
| | |
| | | |
| | | 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"); |
| | |
| | | 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()); |
| | |
| | | |
| | | 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"); |
| | |
| | | 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); |