| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- package cn.com.goldenwater.dcproj.service.impl;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.constValue.BisInspEnum;
- import cn.com.goldenwater.dcproj.constValue.SplitValue;
- import cn.com.goldenwater.dcproj.constValue.StateEnum;
- import cn.com.goldenwater.dcproj.dao.*;
- import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
- import cn.com.goldenwater.dcproj.model.AttWtuntBase;
- import cn.com.goldenwater.dcproj.model.BisInspAllObj;
- import cn.com.goldenwater.dcproj.model.BisInspWtuntRgstr;
- import cn.com.goldenwater.dcproj.param.*;
- import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
- import cn.com.goldenwater.dcproj.service.BisInspWtuntRgstrService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import cn.com.goldenwater.util.common.InspPblmUtils;
- import cn.com.goldenwater.id.util.UuidUtil;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.apache.commons.collections.CollectionUtils;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Date;
- import java.util.List;
- /**
- * @author lune
- * @date 2020-8-17
- */
- @Service
- @Transactional(rollbackFor = Exception.class)
- public class BisInspWtuntRgstrServiceImpl extends AbstractCrudService<BisInspWtuntRgstr, BisInspWtuntRgstrParam> implements BisInspWtuntRgstrService, BisInspObjStrategy {
- @Autowired
- private BisInspWtuntRgstrDao bisInspWtuntRgstrDao;
- @Autowired
- private AttWtuntBaseDao attWtuntBaseDao;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- @Autowired
- private BisInspAllObjDao bisInspAllObjDao;
- @Autowired
- private BisInspWtuntRgstrSteelDao bisInspWtuntRgstrSteelDao;
- @Autowired
- private BisInspWtuntRgstrSteelReoDao bisInspWtuntRgstrSteelReoDao;
- @Autowired
- private BisInspWtuntRgstrCollegeDao bisInspWtuntRgstrCollegeDao;
- @Autowired
- private BisInspWtuntRgstrHotelDao bisInspWtuntRgstrHotelDao;
- @Value("${export.templatePath}")
- private String templatePath;
- public BisInspWtuntRgstrServiceImpl(BisInspWtuntRgstrDao bisInspWtuntRgstrDao) {
- super(bisInspWtuntRgstrDao);
- this.bisInspWtuntRgstrDao = bisInspWtuntRgstrDao;
- }
- @Override
- public PageInfo<BisInspWtuntRgstr> findWtuntPage(TypeParam param) {
- if (StringUtils.isNotBlank(param.getAdCode())) {
- param.setAdCode(String.valueOf(AdLevelUtil.SubAd(param.getAdCode()).get(SplitValue.SUBAD)));
- }
- if (StringUtils.isNotBlank(param.getAdCodes())) {
- param.setAdCodes(AdLevelUtil.getListAddvcd(param.getAdCodes()));
- }
- PageHelper.startPage(param);
- List<BisInspRgstrDto> list = bisInspWtuntRgstrDao.findWtuntPage(param);
- list = InspPblmUtils.changeList(list);
- return new PageInfo(list);
- }
- @Override
- public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
- return this.findWtuntPage(typeParam);
- }
- @Override
- public Object findObjListByType(TypeParam typeParam) {
- List<BisInspRgstrDto> list = bisInspWtuntRgstrDao.findWtuntPage(typeParam);
- return InspPblmUtils.changeList(list);
- }
- @Override
- public String getType() {
- return BisInspEnum.WTUNT.getValue();
- }
- @Override
- public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
- AttWtuntBase attWtuntBase = attWtuntBaseDao.get(bisInspAllObj.getCode());
- BisInspWtuntRgstr rgstr = new BisInspWtuntRgstr();
- BeanUtils.copyProperties(attWtuntBase, rgstr);
- rgstr.setId(UuidUtil.uuid());
- rgstr.setWtuntId(attWtuntBase.getId());
- rgstr.setWtuntStat(StateEnum.NOWASTSTATE.getKey());
- rgstr.setObjId(bisInspAllObj.getObjId());
- rgstr.setIntm(new Date());
- rgstr.setUptm(new Date());
- rgstr.setPersId(persId);
- bisInspWtuntRgstrDao.insert(rgstr);
- }
- @Override
- public void cleanObjData(String objId) {
- BisInspWtuntRgstrParam wtuntRgstrParam = new BisInspWtuntRgstrParam();
- wtuntRgstrParam.setObjId(objId);
- List<BisInspWtuntRgstr> list = bisInspWtuntRgstrDao.findList(wtuntRgstrParam);
- if (CollectionUtils.isNotEmpty(list)) {
- String id = list.get(0).getId();
- //删除问题
- BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
- bisInspPblmParam.setObjId(objId);
- bisInspPblmParam.setObjType(BisInspEnum.WINTU.getValue());
- this.bisInspPblmDao.deleteBy(bisInspPblmParam);
- //删除对象名录表
- BisInspAllObjParam bisInspAllObjParam = new BisInspAllObjParam();
- bisInspAllObjParam.setObjId(objId);
- this.bisInspAllObjDao.deleteBy(bisInspAllObjParam);
- //登记表
- bisInspWtuntRgstrDao.delete(id);
- //(高校)
- BisInspWtuntRgstrCollegeParam collegeParam = new BisInspWtuntRgstrCollegeParam();
- collegeParam.setRgstrId(id);
- bisInspWtuntRgstrCollegeDao.deleteBy(collegeParam);
- //(宾馆)
- BisInspWtuntRgstrHotelParam hotelParam = new BisInspWtuntRgstrHotelParam();
- hotelParam.setRgstrId(id);
- bisInspWtuntRgstrHotelDao.deleteBy(hotelParam);
- //(钢铁)
- BisInspWtuntRgstrSteelParam steelParam = new BisInspWtuntRgstrSteelParam();
- steelParam.setRgstrId(id);
- bisInspWtuntRgstrSteelDao.deleteBy(steelParam);
- //主要产品产量
- BisInspWtuntRgstrSteelReoParam reoParam = new BisInspWtuntRgstrSteelReoParam();
- reoParam.setRgstrId(id);
- bisInspWtuntRgstrSteelReoDao.deleteBy(reoParam);
- }
- }
- }
|