18 changed files with 653 additions and 347 deletions
@ -0,0 +1,91 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
@Data |
|||
public class PatrolRoutineWorkTypeDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 例行工作Id |
|||
*/ |
|||
private String routineWorkId; |
|||
|
|||
/** |
|||
* 例行工作字典项值;type:patrol_work_type |
|||
*/ |
|||
private String workTypeCode; |
|||
|
|||
/** |
|||
* 所有上级类别code组合 |
|||
*/ |
|||
private String allPCode; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.PatrolRoutineWorkTypeEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
@Mapper |
|||
public interface PatrolRoutineWorkTypeDao extends BaseDao<PatrolRoutineWorkTypeEntity> { |
|||
|
|||
} |
@ -0,0 +1,88 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("patrol_routine_work") |
|||
public class PatrolRoutineWorkEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 网格表Id(CUSTOMER_GRID.id)【居民党员角色值为all,热心居民角色对应的网格Id】 |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格所有上级id |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 用户Id user.id |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 事项名称 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 工作日期 格式为“YYYY-MM-DD” |
|||
*/ |
|||
private String happenTime; |
|||
|
|||
/** |
|||
* 有无变动(异常)1:是、0:否 |
|||
*/ |
|||
private Integer isNormal; |
|||
|
|||
/** |
|||
* 工作内容 |
|||
*/ |
|||
private String workContent; |
|||
|
|||
/** |
|||
* 经度 |
|||
*/ |
|||
private String longitude; |
|||
|
|||
/** |
|||
* 纬度 |
|||
*/ |
|||
private String latitude; |
|||
|
|||
} |
@ -0,0 +1,61 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("patrol_routine_work_type") |
|||
public class PatrolRoutineWorkTypeEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户Id customer.id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 例行工作Id |
|||
*/ |
|||
private String routineWorkId; |
|||
|
|||
/** |
|||
* 例行工作字典项值;type:patrol_work_type |
|||
*/ |
|||
private String workTypeCode; |
|||
|
|||
/** |
|||
* 所有上级类别code组合 |
|||
*/ |
|||
private String allPCode; |
|||
|
|||
} |
@ -1,87 +0,0 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.GridUserWorkDTO; |
|||
import com.epmet.dto.form.GridUserWorkFormDTO; |
|||
import com.epmet.entity.GridUserWorkEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格员例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-10-19 |
|||
*/ |
|||
public interface GridUserWorkService extends BaseService<GridUserWorkEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<GridUserWorkDTO> |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
PageData<GridUserWorkDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<GridUserWorkDTO> |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
List<GridUserWorkDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return GridUserWorkDTO |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
GridUserWorkDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
void save(GridUserWorkDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
void update(GridUserWorkDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-10-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* @Description 网格员例行工作 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2021/10/19 1:35 下午 |
|||
*/ |
|||
void gridUserWork(GridUserWorkFormDTO formDTO); |
|||
} |
@ -0,0 +1,38 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.PatrolRoutineWorkDTO; |
|||
import com.epmet.dto.form.GridUserWorkFormDTO; |
|||
import com.epmet.entity.PatrolRoutineWorkEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
public interface PatrolRoutineWorkService extends BaseService<PatrolRoutineWorkEntity> { |
|||
|
|||
void gridUserWork(GridUserWorkFormDTO formDTO); |
|||
} |
@ -0,0 +1,31 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.entity.PatrolRoutineWorkTypeEntity; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
public interface PatrolRoutineWorkTypeService extends BaseService<PatrolRoutineWorkTypeEntity> { |
|||
|
|||
} |
@ -1,119 +0,0 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.GridUserWorkDao; |
|||
import com.epmet.dto.CustomerGridDTO; |
|||
import com.epmet.dto.GridUserWorkDTO; |
|||
import com.epmet.dto.form.CustomerGridFormDTO; |
|||
import com.epmet.dto.form.GridUserWorkFormDTO; |
|||
import com.epmet.entity.GridUserWorkEntity; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.GridUserWorkService; |
|||
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 java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 网格员例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-10-19 |
|||
*/ |
|||
@Service |
|||
public class GridUserWorkServiceImpl extends BaseServiceImpl<GridUserWorkDao, GridUserWorkEntity> implements GridUserWorkService { |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
@Override |
|||
public PageData<GridUserWorkDTO> page(Map<String, Object> params) { |
|||
IPage<GridUserWorkEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, GridUserWorkDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<GridUserWorkDTO> list(Map<String, Object> params) { |
|||
List<GridUserWorkEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, GridUserWorkDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<GridUserWorkEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<GridUserWorkEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public GridUserWorkDTO get(String id) { |
|||
GridUserWorkEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, GridUserWorkDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(GridUserWorkDTO dto) { |
|||
GridUserWorkEntity entity = ConvertUtils.sourceToTarget(dto, GridUserWorkEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(GridUserWorkDTO dto) { |
|||
GridUserWorkEntity entity = ConvertUtils.sourceToTarget(dto, GridUserWorkEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
/** |
|||
* @Description 网格员例行工作 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2021/10/19 1:35 下午 |
|||
*/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
@Override |
|||
public void gridUserWork(GridUserWorkFormDTO formDTO) { |
|||
GridUserWorkEntity entity = ConvertUtils.sourceToTarget(formDTO, GridUserWorkEntity.class); |
|||
CustomerGridFormDTO gridFormDTO = new CustomerGridFormDTO(); |
|||
gridFormDTO.setGridId(formDTO.getGridId()); |
|||
Result<CustomerGridDTO> gridBaseInfoData = govOrgOpenFeignClient.getGridBaseInfoByGridId(gridFormDTO); |
|||
if (!gridBaseInfoData.success()){ |
|||
throw new RenException("查询网格基本信息失败......"); |
|||
} |
|||
CustomerGridDTO gridBaseInfo = gridBaseInfoData.getData(); |
|||
entity.setGridName(gridBaseInfo.getGridName()); |
|||
// 暂时为 哈哈,后期缓存加上 gridCode在修改
|
|||
entity.setGridCode("哈哈"); |
|||
entity.setCustomerId(gridBaseInfo.getCustomerId()); |
|||
entity.setParentOrgId(gridBaseInfo.getPid()); |
|||
entity.setOrgName(gridBaseInfo.getAgencyName()); |
|||
entity.setPids(gridBaseInfo.getPids()); |
|||
baseDao.insert(entity); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,132 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.commons.tools.constant.StrConstant; |
|||
import com.epmet.commons.tools.dto.form.DictListFormDTO; |
|||
import com.epmet.commons.tools.dto.result.DictListResultDTO; |
|||
import com.epmet.commons.tools.enums.DictTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dao.PatrolRoutineWorkDao; |
|||
import com.epmet.dto.CustomerGridDTO; |
|||
import com.epmet.dto.form.CustomerGridFormDTO; |
|||
import com.epmet.dto.form.GridUserWorkFormDTO; |
|||
import com.epmet.entity.PatrolRoutineWorkEntity; |
|||
import com.epmet.entity.PatrolRoutineWorkTypeEntity; |
|||
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.PatrolRoutineWorkService; |
|||
import com.epmet.service.PatrolRoutineWorkTypeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
@Service |
|||
public class PatrolRoutineWorkServiceImpl extends BaseServiceImpl<PatrolRoutineWorkDao, PatrolRoutineWorkEntity> implements PatrolRoutineWorkService { |
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
@Autowired |
|||
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|||
@Autowired |
|||
private LoginUserUtil loginUserUtil; |
|||
@Autowired |
|||
PatrolRoutineWorkTypeService patrolRoutineWorkTypeService; |
|||
|
|||
/** |
|||
* @Description 网格员例行工作 |
|||
* @param formDTO |
|||
* @author zxc |
|||
* @date 2021/10/19 1:35 下午 |
|||
*/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
@Override |
|||
public void gridUserWork(GridUserWorkFormDTO formDTO) { |
|||
PatrolRoutineWorkEntity entity = ConvertUtils.sourceToTarget(formDTO, PatrolRoutineWorkEntity.class); |
|||
|
|||
CustomerGridFormDTO gridFormDTO = new CustomerGridFormDTO(); |
|||
gridFormDTO.setGridId(formDTO.getGridId()); |
|||
Result<CustomerGridDTO> gridBaseInfoData = govOrgOpenFeignClient.getGridBaseInfoByGridId(gridFormDTO); |
|||
if (!gridBaseInfoData.success()){ |
|||
throw new EpmetException("查询网格基本信息失败......"); |
|||
} |
|||
CustomerGridDTO gridBaseInfo = gridBaseInfoData.getData(); |
|||
entity.setPids(gridBaseInfo.getPids()); |
|||
//entity.setUserId(loginUserUtil.getLoginUserId());
|
|||
//entity.setCustomerId(loginUserUtil.getLoginUserCustomerId());
|
|||
|
|||
entity.setUserId("loginUserUtil.getLoginUserId()"); |
|||
entity.setCustomerId("loginUserUtil.getLoginUserCustomerId()"); |
|||
baseDao.insert(entity); |
|||
|
|||
DictListFormDTO param = new DictListFormDTO(); |
|||
param.setDictType(DictTypeEnum.PATROL_WORK_TYPE.getCode()); |
|||
Result<List<DictListResultDTO>> mapResult = adminOpenFeignClient.dictList(param); |
|||
if (mapResult == null || !mapResult.success() || CollectionUtils.isEmpty(mapResult.getData())){ |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"例行工作类型字典获取失败!"); |
|||
} |
|||
Map<String, List<DictListResultDTO>> dictMap = mapResult.getData().stream().collect(Collectors.groupingBy(DictListResultDTO::getPValue)); |
|||
|
|||
Map<String, StringBuilder> allPCodeMap = new HashMap<>(); |
|||
dictMap.forEach((pCode,list)->{ |
|||
if (NumConstant.ZERO_STR.equals(pCode)){ |
|||
return; |
|||
} |
|||
list.forEach(dict->{ |
|||
String code = dict.getValue(); |
|||
StringBuilder stringBuilder = allPCodeMap.get(code); |
|||
if (stringBuilder == null){ |
|||
stringBuilder = new StringBuilder(); |
|||
allPCodeMap.put(code, stringBuilder); |
|||
} |
|||
stringBuilder.insert(dict.getPValue().length()/2,code).append(StrConstant.COLON); |
|||
}); |
|||
|
|||
}); |
|||
List<PatrolRoutineWorkTypeEntity> workTypeList = new ArrayList<>(); |
|||
formDTO.getWorkTypeList().forEach(code->{ |
|||
PatrolRoutineWorkTypeEntity typeEntity = new PatrolRoutineWorkTypeEntity(); |
|||
typeEntity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|||
typeEntity.setRoutineWorkId(entity.getId()); |
|||
typeEntity.setWorkTypeCode(code); |
|||
typeEntity.setAllPCode(allPCodeMap.get(code).toString()); |
|||
workTypeList.add(typeEntity); |
|||
}); |
|||
patrolRoutineWorkTypeService.insertBatch(workTypeList); |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.dao.PatrolRoutineWorkTypeDao; |
|||
import com.epmet.entity.PatrolRoutineWorkTypeEntity; |
|||
import com.epmet.service.PatrolRoutineWorkTypeService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* 巡查例行工作 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-21 |
|||
*/ |
|||
@Service |
|||
public class PatrolRoutineWorkTypeServiceImpl extends BaseServiceImpl<PatrolRoutineWorkTypeDao, PatrolRoutineWorkTypeEntity> implements PatrolRoutineWorkTypeService { |
|||
|
|||
|
|||
} |
@ -1,7 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.GridUserWorkDao"> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.PatrolRoutineWorkDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.PatrolRoutineWorkEntity" id="patrolRoutineWorkMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="title" column="TITLE"/> |
|||
<result property="happenTime" column="HAPPEN_TIME"/> |
|||
<result property="isNormal" column="IS_NORMAL"/> |
|||
<result property="workContent" column="WORK_CONTENT"/> |
|||
<result property="longitude" column="LONGITUDE"/> |
|||
<result property="latitude" column="LATITUDE"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.PatrolRoutineWorkTypeDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.PatrolRoutineWorkTypeEntity" id="patrolRoutineWorkTypeMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="routineWorkId" column="ROUTINE_WORK_ID"/> |
|||
<result property="workTypeCode" column="WORK_TYPE_CODE"/> |
|||
<result property="allPCode" column="ALL_P_CODE"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue