| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package cn.com.goldenwater.dcproj.service.impl.zhejiang;
- 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.AttZhejiangJgBaseDao;
- import cn.com.goldenwater.dcproj.dao.BisInspAllObjDao;
- import cn.com.goldenwater.dcproj.dao.BisInspPblmDao;
- import cn.com.goldenwater.dcproj.dao.BisZhejiangJgRgstrDao;
- import cn.com.goldenwater.dcproj.dto.BisInspRgstrDto;
- import cn.com.goldenwater.dcproj.model.AttZhejiangJgBase;
- import cn.com.goldenwater.dcproj.model.BisInspAllObj;
- import cn.com.goldenwater.dcproj.model.BisZhejiangJgRgstr;
- import cn.com.goldenwater.dcproj.param.BisInspPblmParam;
- import cn.com.goldenwater.dcproj.param.BisZhejiangJgRgstrParam;
- import cn.com.goldenwater.dcproj.service.BisInspObjStrategy;
- import cn.com.goldenwater.dcproj.service.BisZhejiangJgRgstrService;
- import cn.com.goldenwater.core.service.AbstractCrudService;
- import cn.com.goldenwater.dcproj.utils.AdLevelUtil;
- 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.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 cn.com.goldenwater.dcproj.param.TypeParam;
- /**
- * @author lune
- * @date 2020-5-12
- */
- @Service
- @Transactional
- public class BisZhejiangJgRgstrServiceImpl extends AbstractCrudService<BisZhejiangJgRgstr, BisZhejiangJgRgstrParam> implements BisZhejiangJgRgstrService,BisInspObjStrategy {
- private static final Integer INT_TWO = 2;
- private static final Integer INT_THREE = 3;
- @Autowired
- private AttZhejiangJgBaseDao attZhejiangJgBaseDao;
- @Autowired
- private BisInspAllObjDao bisInspAllObjDao;
- @Autowired
- private BisInspPblmDao bisInspPblmDao;
- @Autowired
- private BisZhejiangJgRgstrDao bisZhejiangJgRgstrDao;
- public BisZhejiangJgRgstrServiceImpl(BisZhejiangJgRgstrDao bisZhejiangJgRgstrDao) {
- super(bisZhejiangJgRgstrDao);
- this.bisZhejiangJgRgstrDao = bisZhejiangJgRgstrDao;
- }
- /**
- * 获取浙江强监管分页列表
- * @param typeParam 传参对象
- * @return
- */
- @Override
- public PageInfo<BisInspRgstrDto> getZhejiangJgRegstrInfo(TypeParam typeParam) {
- PageHelper.startPage(typeParam);
- return new PageInfo<BisInspRgstrDto>(getResult(typeParam));
- }
- private List<BisInspRgstrDto> getResult(TypeParam typeParam){
- if (StringUtils.isNotBlank(typeParam.getAdCode())) {
- typeParam.setAdCode(String.valueOf(AdLevelUtil.SubAd(typeParam.getAdCode()).get(SplitValue.SUBAD)));
- }
- List<BisInspRgstrDto> bisInspRgstrList = bisZhejiangJgRgstrDao.getZhejiangJgRegstrInfo(typeParam);
- if(CollectionUtils.isNotEmpty(bisInspRgstrList)){
- bisInspRgstrList.stream().forEach(bisInspRgstrDto -> {
- if(bisInspRgstrDto.getLocation() != null && bisInspRgstrDto.getLocation().contains(SplitValue.HENG_SPLIT)){
- String[] split = bisInspRgstrDto.getLocation().split(SplitValue.HENG_SPLIT);
- if (split.length == INT_THREE) {
- bisInspRgstrDto.setProvince(split[0]);
- bisInspRgstrDto.setCity(split[1]);
- bisInspRgstrDto.setCountry(split[2]);
- }
- if (split.length == INT_TWO) {
- bisInspRgstrDto.setProvince(split[0]);
- bisInspRgstrDto.setCity(split[1]);
- bisInspRgstrDto.setCountry("");
- }else{
- bisInspRgstrDto.setProvince( bisInspRgstrDto.getLocation());
- }
- }
- });
- }
- return bisInspRgstrList;
- }
- @Override
- public void insertObj(BisInspAllObj bisInspAllObj, String persId) {
- AttZhejiangJgBase attAdXBase = attZhejiangJgBaseDao.get(bisInspAllObj.getCode());
- BisZhejiangJgRgstr bisZhejiangJgRgstr = new BisZhejiangJgRgstr();
- bisZhejiangJgRgstr.setId(UuidUtil.uuid());
- bisZhejiangJgRgstr.setAdCode(attAdXBase.getAdCode());
- bisZhejiangJgRgstr.setAdFullName(attAdXBase.getAdFullName());
- bisZhejiangJgRgstr.setLgtd(attAdXBase.getLgtd());
- bisZhejiangJgRgstr.setLttd(attAdXBase.getLttd());
- bisZhejiangJgRgstr.setLgtdpc(attAdXBase.getLgtdpc());
- bisZhejiangJgRgstr.setDepartId(bisInspAllObj.getCode());
- bisZhejiangJgRgstr.setLttdpc(attAdXBase.getLttdpc());
- bisZhejiangJgRgstr.setState("0");
- bisZhejiangJgRgstr.setIntm(new Date());
- bisZhejiangJgRgstr.setUptm(new Date());
- bisZhejiangJgRgstr.setPersId(persId);
- bisZhejiangJgRgstr.setObjId(bisInspAllObj.getObjId());
- bisZhejiangJgRgstr.setRegsNm(attAdXBase.getDepartNm());
- bisZhejiangJgRgstr.setJgState(StateEnum.NOWASTSTATE.getKey());
- bisZhejiangJgRgstr.setNote(attAdXBase.getNote());
- bisZhejiangJgRgstrDao.insert(bisZhejiangJgRgstr);
- }
- @Override
- public String getType() {
- return BisInspEnum.BIS_ZHEJIANG_JG_RGSTR.getValue();
- }
- @Override
- public void cleanObjData(String objId) {
- BisZhejiangJgRgstrParam param = new BisZhejiangJgRgstrParam();
- param.setObjId(objId);
- List<BisZhejiangJgRgstr> list = bisZhejiangJgRgstrDao.findList(param);
- if (list.size() > 0) {
- String id = list.get(0).getId();
- bisZhejiangJgRgstrDao.delete(id);
- BisInspPblmParam bisInspPblmParam = new BisInspPblmParam();
- bisInspPblmParam.setRegid(id);
- this.bisInspPblmDao.deleteBy(bisInspPblmParam);
- this.bisInspAllObjDao.delete(objId);
- }
- }
- @Override
- public PageInfo findObjPageByType(TypeParam typeParam, HttpServletResponse response) {
- return getZhejiangJgRegstrInfo(typeParam);
- }
- @Override
- public Object findObjListByType(TypeParam typeParam) {
- return getResult(typeParam);
- }
- }
|