forked from luyan/epmet-cloud-lingshan
10 changed files with 388 additions and 0 deletions
@ -0,0 +1,117 @@ |
|||||
|
/** |
||||
|
* 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.indexcollect; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区网格员基础信息 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScreenPyGridStaffDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID 主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格Id |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 网格编码 |
||||
|
*/ |
||||
|
private String gridCode; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员Id |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 网格员姓名 |
||||
|
*/ |
||||
|
private String staffName; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 是否离职,格式为Y:是、N:否 |
||||
|
*/ |
||||
|
private String isLeave; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0未删除;1已删除 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; |
||||
|
import com.epmet.service.evaluationindex.indexcoll.ScreenPyGridStaffService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
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; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区网格员基础信息 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@RequestMapping("screenPyGridStaff") |
||||
|
public class ScreenPyGridStaffController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ScreenPyGridStaffService screenPyStaffDataService; |
||||
|
|
||||
|
|
||||
|
@PostMapping("savelist") |
||||
|
public Result saveList(@RequestBody List<ScreenPyGridStaffDTO> dtoList) { |
||||
|
screenPyStaffDataService.saveList(dtoList); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.epmet.dao.evaluationindex.indexcoll; /** |
||||
|
* 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/>.
|
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区网格员基础信息 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ScreenPyGridStaffDao extends BaseDao<ScreenPyGridStaffEntity> { |
||||
|
|
||||
|
ScreenPyGridStaffEntity selectStaff(@Param("gridId") String gridId, @Param("staffId") String staffId); |
||||
|
|
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
/** |
||||
|
* 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.evaluationindex.indexcoll; |
||||
|
|
||||
|
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 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("screen_py_grid_staff") |
||||
|
public class ScreenPyGridStaffEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 客户Id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格Id |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 网格编码 |
||||
|
*/ |
||||
|
private String gridCode; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String pids; |
||||
|
|
||||
|
/** |
||||
|
* 工作人员Id |
||||
|
*/ |
||||
|
private String staffId; |
||||
|
|
||||
|
/** |
||||
|
* 网格员姓名 |
||||
|
*/ |
||||
|
private String staffName; |
||||
|
|
||||
|
/** |
||||
|
* 手机号 |
||||
|
*/ |
||||
|
private String mobile; |
||||
|
|
||||
|
/** |
||||
|
* 是否离职,格式为Y:是、N:否 |
||||
|
*/ |
||||
|
private String isLeave; |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.epmet.service.evaluationindex.indexcoll; |
||||
|
|
||||
|
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区网格员基础信息 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
*/ |
||||
|
public interface ScreenPyGridStaffService { |
||||
|
|
||||
|
void saveList(List<ScreenPyGridStaffDTO> dtoList); |
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
package com.epmet.service.evaluationindex.indexcoll.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
||||
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.StrConstant; |
||||
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
||||
|
import com.epmet.commons.tools.exception.EpmetException; |
||||
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.constant.DataSourceConstant; |
||||
|
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyGridStaffDao; |
||||
|
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO; |
||||
|
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity; |
||||
|
import com.epmet.service.evaluationindex.indexcoll.ScreenPyGridStaffService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 平阴区网格员基础信息 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
||||
|
public class ScreenPyGridStaffServiceImpl extends BaseServiceImpl<ScreenPyGridStaffDao, ScreenPyGridStaffEntity> implements ScreenPyGridStaffService { |
||||
|
|
||||
|
@Override |
||||
|
public void saveList(List<ScreenPyGridStaffDTO> dtoList) { |
||||
|
dtoList.forEach(d -> { |
||||
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(StrConstant.PY_CUSTOMER, d.getStaffId()); |
||||
|
if (null == staffInfo) { |
||||
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", d.getStaffId())); |
||||
|
} |
||||
|
ScreenPyGridStaffEntity entity = baseDao.selectStaff(d.getGridId(), d.getStaffId()); |
||||
|
//存在就更新 不存在就新增
|
||||
|
if (null != entity) { |
||||
|
ScreenPyGridStaffEntity entity1 = ConvertUtils.sourceToTarget(d, ScreenPyGridStaffEntity.class); |
||||
|
entity1.setId(entity.getId()); |
||||
|
entity1.setPids(("".equals(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":") + staffInfo.getAgencyId()); |
||||
|
baseDao.updateById(entity1); |
||||
|
} else { |
||||
|
ScreenPyGridStaffEntity saveEntity = ConvertUtils.sourceToTarget(d, ScreenPyGridStaffEntity.class); |
||||
|
saveEntity.setId(IdWorker.getIdStr()); |
||||
|
saveEntity.setPids(("".equals(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":") + staffInfo.getAgencyId()); |
||||
|
insert(saveEntity); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
<?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.evaluationindex.indexcoll.ScreenPyGridStaffDao"> |
||||
|
|
||||
|
<select id="selectStaff" resultType="com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
screen_py_grid_staff |
||||
|
WHERE |
||||
|
del_flag = '0' |
||||
|
AND staff_id = #{staffId} |
||||
|
AND grid_id = #{gridId} |
||||
|
LIMIT 1 |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue