forked from luyan/epmet-cloud-lingshan
				
			
				 39 changed files with 938 additions and 88 deletions
			
			
		@ -0,0 +1,24 @@ | 
				
			|||
package com.epmet.commons.rocketmq.messages; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 基础消息体 | 
				
			|||
 * @author liujianjun | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class BaseMQMsgDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 1019260278983535301L; | 
				
			|||
    /** | 
				
			|||
     * 客户Id | 
				
			|||
     */ | 
				
			|||
    private String customerId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 对象id | 
				
			|||
     */ | 
				
			|||
    private String objectId; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,28 @@ | 
				
			|||
package com.epmet.commons.tools.dto.form; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.NoArgsConstructor; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * desc:查询巡查 参数 | 
				
			|||
 * | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2021/6/7 16:23 | 
				
			|||
 */ | 
				
			|||
@NoArgsConstructor | 
				
			|||
@Data | 
				
			|||
public class MidBaseFormDTO extends PageFormDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 7585836892408288392L; | 
				
			|||
    /** | 
				
			|||
     * 客户Id | 
				
			|||
     */ | 
				
			|||
    private String customerId; | 
				
			|||
    /** | 
				
			|||
     * 对象id 没有则查询全部 | 
				
			|||
     */ | 
				
			|||
    private String objectId; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,58 @@ | 
				
			|||
/** | 
				
			|||
 * 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.opendata.controller; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			|||
import com.epmet.commons.tools.validator.group.DefaultGroup; | 
				
			|||
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; | 
				
			|||
import com.epmet.opendata.service.BaseGridDailyworkService; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			|||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RestController; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 巡查例行工作 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-12-24 | 
				
			|||
 */ | 
				
			|||
@RestController | 
				
			|||
@RequestMapping("basegriddailywork") | 
				
			|||
public class BaseGridDailyworkController { | 
				
			|||
 | 
				
			|||
    @Autowired | 
				
			|||
    private BaseGridDailyworkService baseGridDailyworkService; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 巡查信息中间库同步 分页 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("sync") | 
				
			|||
    public Result getStaffBaseInfo(@RequestBody(required = false) UpsertPatrolRecordForm formDTO) { | 
				
			|||
        ValidatorUtils.validateEntity(formDTO, DefaultGroup.class); | 
				
			|||
        baseGridDailyworkService.insertPatrolRecord(formDTO); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,34 @@ | 
				
			|||
/** | 
				
			|||
 * 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.opendata.dao; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.dao.BaseDao; | 
				
			|||
import com.epmet.opendata.entity.BaseGridDailyworkEntity; | 
				
			|||
import org.apache.ibatis.annotations.Mapper; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 巡查例行工作 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-12-24 | 
				
			|||
 */ | 
				
			|||
@Mapper | 
				
			|||
public interface BaseGridDailyworkDao extends BaseDao<BaseGridDailyworkEntity> { | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,155 @@ | 
				
			|||
/** | 
				
			|||
 * 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.opendata.entity; | 
				
			|||
 | 
				
			|||
import com.baomidou.mybatisplus.annotation.TableLogic; | 
				
			|||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.EqualsAndHashCode; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Date; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 巡查例行工作 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-12-24 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
@EqualsAndHashCode(callSuper=false) | 
				
			|||
@TableName("base_grid_dailywork") | 
				
			|||
public class BaseGridDailyworkEntity implements Serializable { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
	private String id; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 客户Id customer.id | 
				
			|||
     */ | 
				
			|||
	private String customerId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 网格ID | 
				
			|||
     */ | 
				
			|||
	private String gridId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 网格名称 | 
				
			|||
     */ | 
				
			|||
	private String gridName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 一级工作类型 | 
				
			|||
     */ | 
				
			|||
	private String firstWorkType; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 二级工作类型 | 
				
			|||
     */ | 
				
			|||
	private String secondWorkType; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 事项名称 | 
				
			|||
     */ | 
				
			|||
	private String eventName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 发生日期 格式为“YYYY-MM-DD” | 
				
			|||
     */ | 
				
			|||
	private String happenTime; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 有无变动(异常)Y:是、N:否 | 
				
			|||
     */ | 
				
			|||
	private String workResult; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 工作内容 | 
				
			|||
     */ | 
				
			|||
	private String workContent; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 重点场所类别 字典值 | 
				
			|||
     */ | 
				
			|||
	private String keyAreaType; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 宗教活动规模 字典值 | 
				
			|||
     */ | 
				
			|||
	private String regionScale; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 重点场所是否发生变动 Y;N | 
				
			|||
     */ | 
				
			|||
	private String isKeyareaState; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 重点人员是否在当地-当事件类型为【特殊人群服务与管理】时必填 | 
				
			|||
     */ | 
				
			|||
	private String isKeyPeopleLocate; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 重点人员现状 | 
				
			|||
     */ | 
				
			|||
	private String keyPeopleStatus; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 发生地 | 
				
			|||
     */ | 
				
			|||
	private String happenPlace; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 经度 | 
				
			|||
     */ | 
				
			|||
	private String lng; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 纬度 | 
				
			|||
     */ | 
				
			|||
	private String lat; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 抽取状态:0是未抽取,1代表已抽取,2是抽取失败 | 
				
			|||
     */ | 
				
			|||
	//private String flag;
 | 
				
			|||
	@TableLogic | 
				
			|||
	private String delFlag; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 创建人 | 
				
			|||
     */ | 
				
			|||
	private String createBy; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 创建时间 | 
				
			|||
     */ | 
				
			|||
	private Date createTime; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 更新人 | 
				
			|||
     */ | 
				
			|||
	private String updateBy; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 更新时间 | 
				
			|||
     */ | 
				
			|||
	private Date updateTime; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,46 @@ | 
				
			|||
/** | 
				
			|||
 * 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.opendata.service; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.service.BaseService; | 
				
			|||
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; | 
				
			|||
import com.epmet.opendata.entity.BaseGridDailyworkEntity; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 用户巡查主记录 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-10-14 | 
				
			|||
 */ | 
				
			|||
public interface BaseGridDailyworkService extends BaseService<BaseGridDailyworkEntity> { | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * desc:根据条件插入巡查记录 | 
				
			|||
     * @param patrolRecordForm | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm); | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * desc:重新加载数据 | 
				
			|||
     * @param customerId | 
				
			|||
     * @return | 
				
			|||
     */ | 
				
			|||
    Boolean reloadPatrolData(String customerId); | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,180 @@ | 
				
			|||
/** | 
				
			|||
 * 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.opendata.service.impl; | 
				
			|||
 | 
				
			|||
import com.alibaba.fastjson.JSON; | 
				
			|||
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.utils.Result; | 
				
			|||
import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			|||
import com.epmet.commons.tools.validator.group.AddGroup; | 
				
			|||
import com.epmet.dto.form.patrol.PatrolQueryFormDTO; | 
				
			|||
import com.epmet.dto.result.PatrolRoutineWorkResult; | 
				
			|||
import com.epmet.feign.EpmetUserOpenFeignClient; | 
				
			|||
import com.epmet.opendata.dao.BaseGridDailyworkDao; | 
				
			|||
import com.epmet.opendata.dto.ExDeptDTO; | 
				
			|||
import com.epmet.opendata.dto.ExUserDTO; | 
				
			|||
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm; | 
				
			|||
import com.epmet.opendata.entity.BaseGridDailyworkEntity; | 
				
			|||
import com.epmet.opendata.service.BaseGridDailyworkService; | 
				
			|||
import com.epmet.opendata.service.ExDeptService; | 
				
			|||
import com.epmet.opendata.service.ExUserService; | 
				
			|||
import com.epmet.opendata.service.UserPatrolDetailService; | 
				
			|||
import lombok.extern.slf4j.Slf4j; | 
				
			|||
import org.jetbrains.annotations.NotNull; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.stereotype.Service; | 
				
			|||
import org.springframework.util.CollectionUtils; | 
				
			|||
 | 
				
			|||
import java.util.ArrayList; | 
				
			|||
import java.util.List; | 
				
			|||
import java.util.Map; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 用户例行工作主记录 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2021-10-14 | 
				
			|||
 */ | 
				
			|||
@Slf4j | 
				
			|||
@Service | 
				
			|||
public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyworkDao, BaseGridDailyworkEntity> implements BaseGridDailyworkService { | 
				
			|||
 | 
				
			|||
    @Autowired | 
				
			|||
    private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | 
				
			|||
    @Autowired | 
				
			|||
    private UserPatrolDetailService userPatrolDetailService; | 
				
			|||
    @Autowired | 
				
			|||
    private ExDeptService exDeptService; | 
				
			|||
    @Autowired | 
				
			|||
    private ExUserService exUserService; | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public Boolean insertPatrolRecord(UpsertPatrolRecordForm patrolRecordForm) { | 
				
			|||
        log.info("upsertPatrolRecord param:{}", JSON.toJSONString(patrolRecordForm)); | 
				
			|||
        ValidatorUtils.validateEntity(patrolRecordForm, AddGroup.class); | 
				
			|||
        PatrolQueryFormDTO midPatrolFormDTO = buildParam(patrolRecordForm); | 
				
			|||
        Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkList(midPatrolFormDTO); | 
				
			|||
        if (record == null || !record.success()) { | 
				
			|||
            log.error("获取例行工作记录失败,param:{}", JSON.toJSONString(midPatrolFormDTO)); | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
        Map<String, ExDeptDTO> deptMap = exDeptService.getDeptDTOMap(patrolRecordForm.getCustomerId()); | 
				
			|||
        Map<String, ExUserDTO> userMap = exUserService.getUserDTOMap(patrolRecordForm.getCustomerId()); | 
				
			|||
        List<PatrolRoutineWorkResult> data = record.getData(); | 
				
			|||
        if (CollectionUtils.isEmpty(data)) { | 
				
			|||
            //数据已被删除了
 | 
				
			|||
            //暂时设置error 用于排错
 | 
				
			|||
            log.error("获取例行工作记录返回为空,param:{}", JSON.toJSONString(midPatrolFormDTO)); | 
				
			|||
            int effectRow = baseDao.deleteById(patrolRecordForm.getId()); | 
				
			|||
            log.warn("del effectRow:{}", effectRow); | 
				
			|||
            return true; | 
				
			|||
        } | 
				
			|||
        insertRecordBatch(data, deptMap, userMap); | 
				
			|||
        return true; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public Boolean reloadPatrolData(String customerId) { | 
				
			|||
        int pageNo = NumConstant.ONE; | 
				
			|||
        int pageSize = NumConstant.ONE_THOUSAND; | 
				
			|||
        List<PatrolRoutineWorkResult> resultList = null; | 
				
			|||
        Map<String, ExDeptDTO> deptMap = exDeptService.getDeptDTOMap(customerId); | 
				
			|||
        Map<String, ExUserDTO> userMap = exUserService.getUserDTOMap(customerId); | 
				
			|||
        do { | 
				
			|||
            PatrolQueryFormDTO param = new PatrolQueryFormDTO(); | 
				
			|||
            param.setCustomerId(customerId); | 
				
			|||
            param.setPageNo(pageNo++); | 
				
			|||
            param.setPageSize(pageSize); | 
				
			|||
            Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkList(param); | 
				
			|||
            if (record == null || !record.success()) { | 
				
			|||
                log.error("获取例行工作记录失败,param:{}", JSON.toJSONString(param)); | 
				
			|||
                return false; | 
				
			|||
            } | 
				
			|||
            resultList = record.getData(); | 
				
			|||
            if (CollectionUtils.isEmpty(resultList)){ | 
				
			|||
                log.warn("不存在例行工作记录,param:{}", JSON.toJSONString(param)); | 
				
			|||
                return false; | 
				
			|||
            } | 
				
			|||
            insertRecordBatch(resultList, deptMap, userMap); | 
				
			|||
        }while (!CollectionUtils.isEmpty(resultList) && resultList.size()> pageSize ); | 
				
			|||
 | 
				
			|||
        return null; | 
				
			|||
    } | 
				
			|||
    private Boolean insertRecordBatch(List<PatrolRoutineWorkResult> list, Map<String, ExDeptDTO> deptMap, Map<String, ExUserDTO> userMap){ | 
				
			|||
        List<BaseGridDailyworkEntity> insertList = new ArrayList<>(); | 
				
			|||
        list.forEach(o-> insertList.add(buildEntity(o, deptMap, userMap))); | 
				
			|||
        //insert
 | 
				
			|||
        if (CollectionUtils.isEmpty(insertList)){ | 
				
			|||
            log.error("构建要插入的数据为空,param:{}", JSON.toJSONString(list)); | 
				
			|||
            return false; | 
				
			|||
        } | 
				
			|||
        this.saveOrUpdateBatch(insertList, NumConstant.ONE_HUNDRED); | 
				
			|||
 | 
				
			|||
        return true; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    private BaseGridDailyworkEntity buildEntity(PatrolRoutineWorkResult record, Map<String, ExDeptDTO> deptMap, Map<String, ExUserDTO> userMap) { | 
				
			|||
        BaseGridDailyworkEntity entity = new BaseGridDailyworkEntity(); | 
				
			|||
        entity.setCustomerId(record.getCustomerId()); | 
				
			|||
 | 
				
			|||
        ExDeptDTO exDeptDTO = deptMap.getOrDefault(record.getGridId(),new ExDeptDTO()); | 
				
			|||
        entity.setGridId(exDeptDTO.getDeptId() == null ? "":exDeptDTO.getDeptId().toString()); | 
				
			|||
        entity.setGridName(exDeptDTO.getDeptName()); | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        entity.setFirstWorkType(record.getWorkTypeFirstCode()); | 
				
			|||
        entity.setSecondWorkType(record.getWorkTypeSecondCode()); | 
				
			|||
        entity.setEventName(record.getTitle()); | 
				
			|||
        entity.setHappenTime(record.getHappenTime()); | 
				
			|||
        entity.setWorkResult(NumConstant.ONE == record.getIsNormal()? "Y":"N"); | 
				
			|||
        entity.setWorkContent(record.getWorkContent()); | 
				
			|||
        //业务暂时不支持
 | 
				
			|||
        entity.setKeyAreaType(StrConstant.EPMETY_STR); | 
				
			|||
        entity.setRegionScale(StrConstant.EPMETY_STR); | 
				
			|||
        entity.setIsKeyareaState(StrConstant.EPMETY_STR); | 
				
			|||
        entity.setIsKeyPeopleLocate(NumConstant.ONE == record.getIsKeyPeopleLocate()?"Y":"N"); | 
				
			|||
        entity.setKeyPeopleStatus(record.getKeyPeopleStatus()); | 
				
			|||
        entity.setHappenPlace(record.getAddress()); | 
				
			|||
        entity.setLng(record.getLongitude()); | 
				
			|||
        entity.setLat(record.getLatitude()); | 
				
			|||
        //entity.setFlag(NumConstant.ZERO_STR);
 | 
				
			|||
        Integer userId = userMap.getOrDefault(record.getCreatedBy(), new ExUserDTO()).getUserId(); | 
				
			|||
        entity.setCreateBy(userId == null?record.getCreatedBy():userId.toString()); | 
				
			|||
        entity.setCreateTime(record.getCreatedTime()); | 
				
			|||
        Integer userIdU = userMap.getOrDefault(record.getUpdatedBy(), new ExUserDTO()).getUserId(); | 
				
			|||
        entity.setUpdateBy(userIdU == null? record.getCreatedBy():userIdU.toString()); | 
				
			|||
        entity.setUpdateTime(record.getUpdatedTime()); | 
				
			|||
        entity.setId(record.getId()+"_PY"); | 
				
			|||
        entity.setDelFlag(NumConstant.ZERO_STR); | 
				
			|||
        return entity; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    @NotNull | 
				
			|||
    private PatrolQueryFormDTO buildParam(UpsertPatrolRecordForm patrolRecordForm) { | 
				
			|||
        PatrolQueryFormDTO midPatrolFormDTO = new PatrolQueryFormDTO(); | 
				
			|||
        midPatrolFormDTO.setCustomerId(patrolRecordForm.getCustomerId()); | 
				
			|||
        midPatrolFormDTO.setId(patrolRecordForm.getId()); | 
				
			|||
        midPatrolFormDTO.setPageNo(patrolRecordForm.getPageNo()); | 
				
			|||
        midPatrolFormDTO.setPageSize(patrolRecordForm.getPageSize()); | 
				
			|||
        return midPatrolFormDTO; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,35 @@ | 
				
			|||
<?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.opendata.dao.BaseGridDailyworkDao"> | 
				
			|||
 | 
				
			|||
    <resultMap type="com.epmet.opendata.entity.BaseGridDailyworkEntity" id="patrolRoutineWorkMap"> | 
				
			|||
        <result property="id" column="ID"/> | 
				
			|||
        <result property="customerId" column="CUSTOMER_ID"/> | 
				
			|||
        <result property="gridId" column="GRID_ID"/> | 
				
			|||
        <result property="gridName" column="GRID_NAME"/> | 
				
			|||
        <result property="firstWorkType" column="FIRST_WORK_TYPE"/> | 
				
			|||
        <result property="secondWorkType" column="SECOND_WORK_TYPE"/> | 
				
			|||
        <result property="eventName" column="EVENT_NAME"/> | 
				
			|||
        <result property="happenTime" column="HAPPEN_TIME"/> | 
				
			|||
        <result property="workResult" column="WORK_RESULT"/> | 
				
			|||
        <result property="workContent" column="WORK_CONTENT"/> | 
				
			|||
        <result property="keyAreaType" column="KEY_AREA_TYPE"/> | 
				
			|||
        <result property="regionScale" column="REGION_SCALE"/> | 
				
			|||
        <result property="isKeyareaState" column="IS_KEYAREA_STATE"/> | 
				
			|||
        <result property="isKeyPeopleLocate" column="IS_KEY_PEOPLE_LOCATE"/> | 
				
			|||
        <result property="keyPeopleStatus" column="KEY_PEOPLE_STATUS"/> | 
				
			|||
        <result property="happenPlace" column="HAPPEN_PLACE"/> | 
				
			|||
        <result property="lng" column="LNG"/> | 
				
			|||
        <result property="lat" column="LAT"/> | 
				
			|||
        <result property="flag" column="FLAG"/> | 
				
			|||
        <result property="delFlag" column="DEL_FLAG"/> | 
				
			|||
        <result property="revision" column="REVISION"/> | 
				
			|||
        <result property="createBy" column="CREATE_BY"/> | 
				
			|||
        <result property="createTime" column="CREATE_TIME"/> | 
				
			|||
        <result property="updateBy" column="UPDATE_BY"/> | 
				
			|||
        <result property="updateTime" column="UPDATE_TIME"/> | 
				
			|||
    </resultMap> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
</mapper> | 
				
			|||
@ -0,0 +1,29 @@ | 
				
			|||
package com.epmet.dto.form.patrol; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.dto.form.PageFormDTO; | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.NoArgsConstructor; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * desc:查询巡查 参数 | 
				
			|||
 * | 
				
			|||
 * @author zhaoqifeng | 
				
			|||
 * @dscription | 
				
			|||
 * @date 2021/6/7 16:23 | 
				
			|||
 */ | 
				
			|||
@NoArgsConstructor | 
				
			|||
@Data | 
				
			|||
public class PatrolQueryFormDTO extends PageFormDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 7585836892408288392L; | 
				
			|||
    /** | 
				
			|||
     * 客户Id | 
				
			|||
     */ | 
				
			|||
    private String customerId; | 
				
			|||
    /** | 
				
			|||
     * 对象id 没有则查询全部 | 
				
			|||
     */ | 
				
			|||
    private String id; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,78 @@ | 
				
			|||
package com.epmet.dto.result; | 
				
			|||
 | 
				
			|||
import com.fasterxml.jackson.annotation.JsonFormat; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Date; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * desc:例行工作结果 | 
				
			|||
 * | 
				
			|||
 * @Author zxc | 
				
			|||
 * @DateTime 2021/10/19 10:41 上午 | 
				
			|||
 * @DESC | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class PatrolRoutineWorkResult implements Serializable { | 
				
			|||
 | 
				
			|||
    private static final long serialVersionUID = 6508374707998213266L; | 
				
			|||
    private String id; | 
				
			|||
 | 
				
			|||
    private String customerId; | 
				
			|||
 | 
				
			|||
    private String gridId; | 
				
			|||
 | 
				
			|||
    private String title; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 一级工作类型 code | 
				
			|||
     */ | 
				
			|||
    private String workTypeFirstCode; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 二级工作类型 code | 
				
			|||
     */ | 
				
			|||
    private String workTypeSecondCode; | 
				
			|||
 | 
				
			|||
    private Integer isNormal; | 
				
			|||
 | 
				
			|||
    private String happenTime; | 
				
			|||
 | 
				
			|||
    private String workContent; | 
				
			|||
 | 
				
			|||
    private String address; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 当事件类型为【特殊人群服务与管理】时必填 重点人员是否在当地 | 
				
			|||
     */ | 
				
			|||
    private Integer isKeyPeopleLocate; | 
				
			|||
    /** | 
				
			|||
     * 当事件类型为【特殊人群服务与管理】时必填 重点人员现状 | 
				
			|||
     */ | 
				
			|||
    private String keyPeopleStatus; | 
				
			|||
    /** | 
				
			|||
     * 经度 | 
				
			|||
     */ | 
				
			|||
    private String longitude; | 
				
			|||
    /** | 
				
			|||
     * 纬度 | 
				
			|||
     */ | 
				
			|||
    private String latitude; | 
				
			|||
 | 
				
			|||
    private Integer revision; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    private String createdBy; | 
				
			|||
 | 
				
			|||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 
				
			|||
    private Date createdTime; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    private String updatedBy; | 
				
			|||
 | 
				
			|||
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 
				
			|||
    private Date updatedTime; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue