| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- 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.dao.AttProjectInsuranceDao;
- import cn.com.goldenwater.dcproj.dao.AttProjectInsuranceRecordDao;
- import cn.com.goldenwater.dcproj.dao.BisInspAnzeRgstrDao;
- import cn.com.goldenwater.dcproj.dto.BisInspAnzeRgstrDto;
- import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
- import cn.com.goldenwater.dcproj.exception.ServiceException;
- import cn.com.goldenwater.dcproj.model.AttProjectInsurance;
- import cn.com.goldenwater.dcproj.model.AttProjectInsuranceRecord;
- import cn.com.goldenwater.dcproj.model.BisInspAllObj;
- import cn.com.goldenwater.dcproj.model.BisInspAnzeRgstr;
- import cn.com.goldenwater.dcproj.param.AttProjectInsuranceRecordParam;
- import cn.com.goldenwater.dcproj.param.BisInspAnzeRgstrParam;
- import cn.com.goldenwater.dcproj.param.TypeParam;
- import cn.com.goldenwater.dcproj.service.BisInspAnzeRgstrService;
- import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- import cn.com.goldenwater.dcproj.utils.StringUtils;
- import cn.com.goldenwater.id.util.UuidUtil;
- import cn.com.goldenwater.util.common.InspPblmUtils;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.apache.commons.collections4.CollectionUtils;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import javax.servlet.http.HttpServletResponse;
- import java.util.Date;
- import java.util.List;
- import java.util.Optional;
- /**
- * @author lql
- * @date 2026-4-21
- */
- @Service
- @Transactional
- public class BisInspAnzeRgstrServiceImpl extends AbstractCrudService<BisInspAnzeRgstr, BisInspAnzeRgstrParam> implements BisInspAnzeRgstrService, BisInspObjStrategy {
- @Autowired
- private BisInspAnzeRgstrDao bisInspAnzeRgstrDao;
- @Autowired
- private AttProjectInsuranceDao attProjectInsuranceDao;
- @Autowired
- private AttProjectInsuranceRecordDao attProjectInsuranceRecordDao;
- public BisInspAnzeRgstrServiceImpl(BisInspAnzeRgstrDao bisInspAnzeRgstrDao) {
- super(bisInspAnzeRgstrDao);
- this.bisInspAnzeRgstrDao = bisInspAnzeRgstrDao;
- }
- @Override
- public int insert(BisInspAnzeRgstr bisInspAnzeRgstr) {
- String uuid = UuidUtil.uuid();
- bisInspAnzeRgstr.setId(uuid);
- return this.bisInspAnzeRgstrDao.insert(bisInspAnzeRgstr);
- }
- @Override
- public int update(BisInspAnzeRgstr bisInspAnzeRgstr) {
- bisInspAnzeRgstr.setUptm(new Date());
- return this.bisInspAnzeRgstrDao.update(bisInspAnzeRgstr);
- }
- @Override
- public int delete(String id) {
- // 删除
- return this.bisInspAnzeRgstrDao.delete(id);
- }
- @Override
- public PageInfo<BisInspAnzeRgstrDto> findAnzePage(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<BisInspAnzeRgstrDto> list = bisInspAnzeRgstrDao.findPageList(param);
- return new PageInfo<>(list);
- }
- @Override
- public AttProjectInsurance getBaseById(String id) {
- return bisInspAnzeRgstrDao.getBaseById(id);
- }
- @Override
- public AttProjectInsuranceRecord getRecord(String id) {
- AttProjectInsurance attProjectInsurance = bisInspAnzeRgstrDao.getBaseById(id);
- Optional.ofNullable(attProjectInsurance).orElseThrow(() -> new ServiceException("未找到数据"));
- AttProjectInsuranceRecordParam param = new AttProjectInsuranceRecordParam();
- param.setRgstrId(attProjectInsurance.getId());
- List<AttProjectInsuranceRecord> list = attProjectInsuranceRecordDao.findList(param);
- if (!CollectionUtils.isEmpty(list)) {
- return list.get(0);
- }
- return null;
- }
- @Override
- public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
- BisInspAnzeRgstr b = new BisInspAnzeRgstr();
- AttProjectInsurance base = attProjectInsuranceDao.get(bisInspAllObj.getCode());
- BeanUtils.copyProperties(base, b);
- b.setObjId(bisInspAllObj.getObjId());
- b.setId(UuidUtil.uuid());
- b.setNm(base.getName());
- b.setIntm(new Date());
- b.setUptm(new Date());
- b.setDataStat("0");
- b.setState("0");
- /* 添加 登记表 */
- bisInspAnzeRgstrDao.insert(b);
- }
- @Override
- public String getType() {
- return BisInspEnum.ANZE.getValue();
- }
- @Override
- public void cleanObjData(String objId) {
- BisInspAnzeRgstrParam rgstrParam = new BisInspAnzeRgstrParam();
- rgstrParam.setObjId(objId);
- List<BisInspAnzeRgstr> list = this.bisInspAnzeRgstrDao.findList(rgstrParam);
- if (list.size() > 0) {
- String id = list.get(0).getId();
- // 删除登记表
- this.bisInspAnzeRgstrDao.delete(id);
- }
- }
- @Override
- public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
- if (StringUtils.isNotBlank(typeParam.getAdCode())) {
- typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
- }
- PageHelper.startPage(typeParam);
- List<BisInspAnzeRgstrDto> list = this.bisInspAnzeRgstrDao.findPageList(typeParam);
- return new PageInfo<>(list);
- }
- @Override
- public Object findObjListByType(TypeParam typeParam) {
- List<BisInspRgstrDto> list = bisInspAnzeRgstrDao.findAnzeList(typeParam);
- return InspPblmUtils.changeList(list);
- }
- }
|