123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- package com.ghsc.partybuild.service.impl;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import com.ghsc.partybuild.mapper.DjFundsuseMapper;
- import com.ghsc.partybuild.mapper.FundsCQuery;
- import com.ghsc.partybuild.model.CfDictionary;
- import com.ghsc.partybuild.model.DjFundsuseWithBLOBs;
- import com.ghsc.partybuild.service.DictionaryService;
- import com.ghsc.partybuild.service.FundsService;
- import com.ghsc.partybuild.util.DateUtils;
- import com.ghsc.partybuild.util.MapUtils;
- import com.ghsc.partybuild.util.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- /**
- * 党组织经费
- *
- * @author pj
- */
- @Service("fundsService")
- public class FundsServiceImpl implements FundsService {
- @Autowired
- private FundsCQuery fundsCquery;
- @Autowired
- private DjFundsuseMapper djFundsuseMapper;
- @Autowired
- private StringUtils stringUtils;
- @Autowired
- private MapUtils mapUtils;
- @Autowired
- private DictionaryService dictionaryService;
- @Autowired
- private DateUtils dateUtils;
- @Override
- public PageInfo<HashMap<String, Object>> getFundsUseList(int page, int rows,String dzzmc, String partyCode, String beginTime, String endTime, Integer expendScope, Integer expendType) {
- List<CfDictionary> dicExpendScope = dictionaryService.getDictionaryListByDicTypeKey("expendScope");
- List<CfDictionary> dicExpendType = dictionaryService.getDictionaryListByDicTypeKey("expendType");
- PageHelper.startPage(page, rows);
- List<HashMap<String, Object>> list = fundsCquery.selectFundsUseList(dzzmc,partyCode, beginTime, endTime, expendScope, expendType);
- for (HashMap<String, Object> item : list) {
- if (item.get("EXPENDSCOPE") != null) {
- item.put("EXPENDSCOPENAME", dictionaryService.getDicByKey(Integer.parseInt(item.get("EXPENDSCOPE").toString()), dicExpendScope).getDicvalue());
- }
- if (item.get("EXPENDTYPE") != null) {
- item.put("EXPENDTYPENAME", dictionaryService.getDicByKey(Integer.parseInt(item.get("EXPENDTYPE").toString()), dicExpendType).getDicvalue());
- }
- }
- PageInfo<HashMap<String, Object>> result = new PageInfo(list);
- return result;
- }
- @Override
- public DjFundsuseWithBLOBs getFundsuseById(String id) {
- return djFundsuseMapper.selectByPrimaryKey(id);
- }
- @Override
- public int saveFundsuse(DjFundsuseWithBLOBs model, String userId, String userName) {
- int result = 0;
- DjFundsuseWithBLOBs dbModel = getFundsuseById(model.getFundsuseid());
- if (dbModel == null || (dbModel != null && stringUtils.IsNullOrEmpty(dbModel.getFundsuseid()))) {
- model.setCreatetime(new Date());
- model.setCreateuserid(userId);
- model.setCreateusername(userName);
- model.setOperatestate("A");
- model.setOperatetime(new Date());
- model.setSyncstate("N");
- result = djFundsuseMapper.insert(model);
- } else {
- model.setUpdatetime(new Date());
- model.setUpdateuserid(userId);
- model.setUpdateusername(userName);
- model.setOperatestate("M");
- model.setOperatetime(new Date());
- model.setSyncstate("N");
- result = djFundsuseMapper.updateByPrimaryKeyWithBLOBs(model);
- }
- return result;
- }
- @Override
- public int deleteFundsuseById(String id) {
- return djFundsuseMapper.deleteByPrimaryKey(id);
- }
- /**
- * @param page
- * @param rows
- * @param partyCode
- * @param year
- * @return
- */
- @Override
- public PageInfo<HashMap<String, Object>> getFundsUsageSummary(int page, int rows, String partyCode, String dzzmc,Integer year,boolean isApp) {
- PageHelper.startPage(page, rows);
- List<HashMap<String, Object>> list = fundsCquery.selectFundsUsageSummary(partyCode, dzzmc,year,null,isApp);
- PageInfo<HashMap<String, Object>> result = new PageInfo(list);
- return result;
- }
- @Override
- public HashMap<String, Object> getFundsUsageSummaryByDzzdm(Integer year,String dzzdm) {
- List<HashMap<String, Object>> list = fundsCquery.selectFundsUsageSummary(null,null, year,dzzdm,true);
- return list.stream().findFirst().get();
- }
- /**
- * @param page
- * @param rows
- * @param partyCode
- * @param year
- * @return
- */
- @Override
- public PageInfo<HashMap<String, Object>> getFundsUsageDetails(int page, int rows, String partyCode, Integer year) {
- PageHelper.startPage(page, rows);
- List<HashMap<String, Object>> list = fundsCquery.selectFundsUsageDetails(partyCode, year);
- PageInfo<HashMap<String, Object>> result = new PageInfo(list);
- return result;
- }
- /**
- * @param partyCode
- * @param expendscope
- * @param year
- * @return
- */
- @Override
- public List<HashMap<String, Object>> getPartyFundsUsage( String partyCode, Integer expendscope,Integer year) {
- List<HashMap<String, Object>> list = fundsCquery.selectPartyFundsUsage(partyCode, expendscope,year);
- return list;
- }
- }
|