Commit 4cca406c authored by daijunxiong's avatar daijunxiong

定时任务---员工部门信息

员工花名册---统计数据为写死测试数据
parent 707e5868
package com.mortals.xhx.base.framework.config;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* @author djx
* @date 2023年04月10日 11:53
*/
@Component
public class JsonUtils {
@Autowired
private ObjectMapper objectMapper;
public String bean2Json(Object data) {
try {
String result = objectMapper.writeValueAsString(data);
return result;
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}
public <T> T json2Bean(String jsonData, Class<T> beanType) {
try {
T result = objectMapper.readValue(jsonData, beanType);
return result;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <T> List<T> json2List(String jsonData, Class<T> beanType) {
JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, beanType);
try {
List<T> resultList = objectMapper.readValue(jsonData, javaType);
return resultList;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public <K, V> Map<K, V> json2Map(String jsonData, Class<K> keyType, Class<V> valueType) {
JavaType javaType = objectMapper.getTypeFactory().constructMapType(Map.class, keyType, valueType);
try {
Map<K, V> resultMap = objectMapper.readValue(jsonData, javaType);
return resultMap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
......@@ -94,6 +94,35 @@ public class ArtemisPostTest {
}
public static String callPostApiGetDeptList() throws Exception {
/**
* https://ip:port/artemis/api/resource/v1/org/orgList
* 通过查阅AI Cloud开放平台文档或网关门户的文档可以看到获取组织列表的接口定义,该接口为POST请求的Rest接口, 入参为JSON字符串,接口协议为https。
* ArtemisHttpUtil工具类提供了doPostStringArtemis调用POST请求的方法,入参可传JSON字符串, 请阅读开发指南了解方法入参,没有的参数可传null
*/
ArtemisConfig config = new ArtemisConfig();
config.setHost("8.136.255.30:8001"); // 代理API网关nginx服务器ip端口
config.setAppKey("25128371"); // 秘钥appkey
config.setAppSecret("2m9RcPJOKq5j2QPQM4v5");// 秘钥appSecret
final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/person/personList";
Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数
paramMap.put("pageNo", "1");
paramMap.put("pageSize", "10");
String body = JSON.toJSON(paramMap).toString();
Map<String, String> path = new HashMap<String, String>(2) {
{
put("http://", getCamsApi);
}
};
return ArtemisHttpUtil.doPostStringArtemis(config,path, body, null, null, "application/json");
}
/**
* 调用POST请求类型接口,这里以分页获取区域列表为例
* 接口实际url:https://ip:port/artemis/api/api/resource/v1/regions
......
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
import java.util.List;
/**
* @author djx
* @date 2023年04月10日 11:56
*/
@Data
public class DeptHikData {
private int total;
private int pageNo;
private int pageSize;
private List<ListDept> list;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author djx
* @date 2023年04月10日 11:54
*/
@NoArgsConstructor
@Data
public class ListDept {
//部门编号--最底层
private String orgIndexCode;
//空
private String orgNo;
//部门名字--底层
private String orgName;
//部门全路径
private String orgPath;
//上级部门编号
private String parentOrgIndexCode;
//上层部门名臣
private Object parentOrgName;
//修改时间
private Object updateTime;
}
......@@ -4,22 +4,40 @@ import lombok.Data;
@Data
public class ListItem{
//空
private Object birthday;
//
private String orgName;
//空
private Object address;
//空
private Object education;
//性别
private int gender;
//部门全路径
private String orgPath;
//空
private Object nation;
//部门code
private String orgIndexCode;
private String updateTime;
//证书
private String certificateNo;
//空
private Object phoneNo;
//姓名
private String personName;
//身份证信息
private PersonPhoto personPhoto;
//
private String jobNo;
//海康id
private String personId;
//指纹
private Object fingerPrint;
//空
private Object email;
//
private int certificateType;
}
\ No newline at end of file
......@@ -3,100 +3,131 @@ package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.base.framework.config.JsonUtils;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.hik.ArtemisPostTest;
import com.mortals.xhx.busiz.rsp.DeptHikData;
import com.mortals.xhx.busiz.rsp.ListDept;
import com.mortals.xhx.busiz.rsp.ListItem;
import com.mortals.xhx.busiz.rsp.PersonHikData;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl;
import com.mortals.xhx.module.staff.model.StaffEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 同步用户
*/
@Slf4j
//@Service("SyncUserTask")
@Service("SyncUserTask")
public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private UserService userService;
@Autowired
private IUserFeign userFeign;
@Autowired
private JsonUtils jsonUtils;
@Autowired
private StaffDaoImpl staffDao;
@Autowired
private DeptDaoImpl deptDao;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("同步用户");
/*SitePdu sitePdu = new SitePdu();
sitePdu.setId(1L);
Rest<List<SitePdu>> siteRest = siteFeign.getFlatSitesBySiteId(sitePdu);
if (siteRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("站点总数量:{}", siteRest.getData().size());
siteRest.getData().forEach(site -> {
log.info("站点名称:{}",site.getSiteName());
DevicePdu devicePdu = new DevicePdu();
devicePdu.setProductCode("ybj");
devicePdu.setSize(-1);
Rest<RespData<List<DevicePdu>>> deviceRest = deviceFeign.list(devicePdu);
log.info("deviceRest:{}", JSON.toJSONString(deviceRest));
if (YesNoEnum.YES.getValue() == deviceRest.getCode()) {
List<DevicePdu> devicePduList = deviceRest.getData().getData();
log.info("样表机总数量:{}", devicePduList.size());
if (!ObjectUtils.isEmpty(devicePduList)) {
List<DeviceEntity> newDeviceList = devicePduList.stream().map(newDevice -> {
DeviceEntity deviceEntity = new DeviceEntity();
deviceEntity.initAttrValue();
BeanUtils.copyProperties(newDevice, deviceEntity, BeanUtil.getNullPropertyNames(newDevice));
return deviceEntity;
}).collect(Collectors.toList());
List<DeviceEntity> oldDeviceList = deviceService.find(new DeviceQuery().siteId(site.getId()));
Map<String, DeviceEntity> oldDeviceMap = oldDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
Map<String, DeviceEntity> newDeviceMap = newDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
List<DeviceEntity> updateDeviceLsit = newDeviceList.stream().map(item -> {
if (oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setId(oldDeviceMap.get(item.getDeviceCode()).getId());
item.setDeviceId(item.getId());
item.setProductCode(oldDeviceMap.get(item.getDeviceCode()).getProductCode());
item.setProductName(oldDeviceMap.get(item.getDeviceCode()).getProductName());
item.setUpdateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
List<DeviceEntity> saveDeviceList = newDeviceList.stream().map(item -> {
if (!oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setDeviceId(item.getId());
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
log.info("同步用户--部门");
try {
String resultPerson = ArtemisPostTest.callPostApiGetPersonList();
PersonHikData personHikData = jsonUtils.json2Bean(resultPerson, PersonHikData.class);
if (Objects.nonNull(personHikData)) {
for (ListItem list : personHikData.getList()) {
//根据id获取本地数据
StaffEntity staffEntity1 = staffDao.get(Long.valueOf(list.getPersonId()));
List<StaffEntity> staffEntitieList = staffDao.queryAllList();
//判断本地数据是否为空
if (Objects.isNull(staffEntity1)) {
//如果为空则将数据存入数据库
staffEntity1.setName(list.getPersonName());
staffEntity1.setRemark(list.getPersonId());
staffEntity1.setPhotoPath(list.getPersonPhoto().getPicUri());
staffEntity1.setDeptName(list.getOrgName());
staffEntity1.setDeptId(Long.valueOf(list.getOrgIndexCode()));
staffEntity1.setDeptName(list.getOrgName());
if (list.getBirthday()!=null){
staffEntity1.setBirthday((Date) list.getBirthday());
}
if (list.getPhoneNo()!=null){
staffEntity1.setPhoneNumber(String.valueOf(list.getPhoneNo()));
}
staffDao.insert(staffEntity1);
}
//本地数据不为空
else {
//本地数据遍历数据
for (StaffEntity staffEntity : staffEntitieList) {
//如果本地的id等于海康的id
if (staffEntity.getRemark().equals(list.getPersonId())) {
//执行修改
staffEntity.setName(list.getPersonName());
staffEntity.setPhotoPath(list.getPersonPhoto().getPicUri());
staffEntity.setDeptName(list.getOrgName());
staffDao.update(staffEntity);
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
for (ListItem item :personHikData.getList()){
//如果本地id不等于海康id并且海康id不等于本地id
if (!item.getPersonId().equals(staffEntity.getRemark())){
//否则执行删除
staffDao.delete(Long.valueOf(staffEntity.getRemark()));
//做差集
List<Long> delDeviceList = oldDeviceList.stream().map(item -> {
if (!newDeviceMap.containsKey(item.getDeviceCode())) {
return item.getId();
}
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateDeviceLsit)) {
log.info("设备更新,size:{}", updateDeviceLsit.size());
deviceService.update(updateDeviceLsit);
}
if (!ObjectUtils.isEmpty(saveDeviceList)) {
log.info("设备新增,size:{}", saveDeviceList.size());
deviceService.save(saveDeviceList);
}
if (!ObjectUtils.isEmpty(delDeviceList)) {
log.info("设备删除,size:{}", delDeviceList.size());
deviceService.remove(delDeviceList,null);
}
}
}
String resultDept = ArtemisPostTest.callPostApiGetDeptList();
DeptHikData deptHikData = jsonUtils.json2Bean(resultDept,DeptHikData.class);
if (Objects.isNull(deptHikData)){
for (ListDept listDept:deptHikData.getList()){
DeptEntity deptEntity = deptDao.get(Long.valueOf(listDept.getOrgIndexCode()));
List<DeptEntity> deptEntityList = deptDao.queryAllList();
if (Objects.isNull(deptEntity)){
deptEntity.setDeptName(listDept.getOrgName());
deptEntity.setParentId(Long.valueOf(listDept.getParentOrgIndexCode()));
deptEntity.setAncestors(listDept.getOrgPath());
deptDao.insert(deptEntity);
}else {
for (DeptEntity deptEntity1 :deptEntityList){
if (!deptEntity1.getParentId().equals(listDept.getOrgIndexCode())){
deptEntity1.setAncestors(listDept.getOrgPath());
deptEntity1.setDeptName(listDept.getOrgName());
deptDao.update(deptEntity1);
}
for (ListDept dept : deptHikData.getList()){
if (!dept.getOrgIndexCode().equals(deptEntity1.getParentId())){
deptDao.delete(Long.valueOf(listDept.getOrgIndexCode()));
}
}
}
}
} else {
log.info("设备列表查询异常,{}", JSON.toJSONString(deviceRest));
}
});
} else {
log.info("站点列表查询异常,{}", JSON.toJSONString(siteRest));
}*/
}
} catch (Exception e) {
e.printStackTrace();
}
}
......
......@@ -21,4 +21,9 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
*/
List<DeptEntity> selectChildrenDeptById(String deptId);
/**
* 查询所有数据
* */
List<DeptEntity> queryAllList();
}
package com.mortals.xhx.module.dept.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 部门信息DaoImpl DAO接口
......@@ -22,4 +22,9 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements
return getSqlSession().selectList(getSqlId("selectChildrenDeptById"), deptId);
}
@Override
public List<DeptEntity> queryAllList() {
return null;
}
}
......@@ -2,7 +2,9 @@ package com.mortals.xhx.module.staff.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.staff.model.StaffEntity;
import java.util.List;
/**
* 员工基本信息Dao
* 员工基本信息 DAO接口
......@@ -14,4 +16,9 @@ import java.util.List;
public interface StaffDao extends ICRUDDao<StaffEntity,Long>{
/**
* 查询所有
* */
List<StaffEntity> queryAllList();
}
package com.mortals.xhx.module.staff.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.staff.dao.StaffDao;
import com.mortals.xhx.module.staff.model.StaffEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 员工基本信息DaoImpl DAO接口
......@@ -17,5 +17,8 @@ import java.util.List;
public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity,Long> implements StaffDao {
@Override
public List<StaffEntity> queryAllList() {
return null;
}
}
package com.mortals.xhx.module.staff.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.vo.StaffVo;
import java.util.Date;
/**
* 员工基本信息实体对象
*
......@@ -93,6 +89,10 @@ public class StaffEntity extends StaffVo {
* 备注
*/
private String remark;
/**
* 备注id
*/
private String remarkId;
/**
* 员工来源(1.外部,2.内部)
*/
......@@ -367,6 +367,20 @@ public class StaffEntity extends StaffVo {
public void setRemark(String remark){
this.remark = remark;
}
/**
* 获取 备注id
* @return String
*/
public String getRemarkId(){
return remarkId;
}
/**
* 设置 备注id
* @param remarkId
*/
public void setRemarkId(String remarkId){
this.remarkId = remarkId;
}
/**
* 获取 员工来源(1.外部,2.内部)
* @return Integer
......@@ -422,6 +436,7 @@ public class StaffEntity extends StaffVo {
sb.append(",regularDate:").append(getRegularDate());
sb.append(",leaveDate:").append(getLeaveDate());
sb.append(",remark:").append(getRemark());
sb.append(",remarkId:").append(getRemarkId());
sb.append(",source:").append(getSource());
return sb.toString();
}
......@@ -466,6 +481,8 @@ public class StaffEntity extends StaffVo {
this.remark = "";
this.remarkId = "";
this.source = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.staff.model;
import java.util.Date;
import java.util.List;
import com.mortals.xhx.module.staff.model.StaffEntity;
/**
* 员工基本信息查询对象
*
* @author zxfei
* @date 2023-04-08
* @date 2023-04-10
*/
public class StaffQuery extends StaffEntity {
/** 开始 序号,主键,自增长 */
......@@ -226,6 +224,11 @@ public class StaffQuery extends StaffEntity {
/** 结束 更新时间 */
private String updateTimeEnd;
/** 备注id */
private List<String> remarkIdList;
/** 备注id排除列表 */
private List <String> remarkIdNotList;
/** 开始 员工来源(1.外部,2.内部) */
private Integer sourceStart;
......@@ -1458,6 +1461,38 @@ public class StaffQuery extends StaffEntity {
this.updateTimeEnd = updateTimeEnd;
}
/**
* 获取 备注id
* @return remarkIdList
*/
public List<String> getRemarkIdList(){
return this.remarkIdList;
}
/**
* 设置 备注id
* @param remarkIdList
*/
public void setRemarkIdList(List<String> remarkIdList){
this.remarkIdList = remarkIdList;
}
/**
* 获取 备注id
* @return remarkIdNotList
*/
public List<String> getRemarkIdNotList(){
return this.remarkIdNotList;
}
/**
* 设置 备注id
* @param remarkIdNotList
*/
public void setRemarkIdNotList(List<String> remarkIdNotList){
this.remarkIdNotList = remarkIdNotList;
}
/**
* 获取 开始 员工来源(1.外部,2.内部)
* @return sourceStart
......@@ -2202,6 +2237,25 @@ public class StaffQuery extends StaffEntity {
}
/**
* 设置 备注id
* @param remarkId
*/
public StaffQuery remarkId(String remarkId){
setRemarkId(remarkId);
return this;
}
/**
* 设置 备注id
* @param remarkIdList
*/
public StaffQuery remarkIdList(List<String> remarkIdList){
this.remarkIdList = remarkIdList;
return this;
}
/**
* 设置 员工来源(1.外部,2.内部)
* @param source
......
package com.mortals.xhx.module.staff.model.vo;
import lombok.Data;
import java.util.Date;
/**
* @author djx
* @date 2023年04月10日 14:20
*/
@Data
public class HolidayListVo {
//姓名
private String workName;
//状态
private String workStatus;
//部门
private String workDept;
//在职期限
private String workLimit;
//入职时间
private Date workBeginDay;
//转正时间
private Date workFormalDay;
//本月实际出勤天数
private String attendanceCount;
//请假天数
private String leaveCount;
//迟到早退天数
private String lateCount;
//矿工天数
private String minerCount;
//缺卡次数
private String lackCardCount;
//加班天数
private String workOverDay;
//调休
private String compensatoryDay;
//婚假
private String marriageHoliday;
//年假
private String winterHoliday;
//陪产假
private String paternityLeaveDay;
}
package com.mortals.xhx.module.staff.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.StaffEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 员工基本信息视图对象
......@@ -16,7 +14,5 @@ public class StaffVo extends BaseEntityLong {
private List <Long> idList;
private List<holidayInfoVo> holidayInfoVoList;
private List<HolidayListVo> holidayLists;
}
\ No newline at end of file
package com.mortals.xhx.module.staff.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.vo.HolidayListVo;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
* 员工基本信息
......@@ -64,7 +57,26 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
@Override
protected int infoAfter(Long id, Map<String, Object> model, StaffEntity entity, Context context) throws AppException {
//todo 员工统计信息
entity.setHolidayInfoVoList(new ArrayList<>());
List<HolidayListVo> holidayListVos = new ArrayList<>();
HolidayListVo vo =new HolidayListVo();
vo.setWorkName("测试");
vo.setWorkStatus("正式");
vo.setWorkDept("技术部门");
vo.setWorkLimit("1003");
vo.setWorkBeginDay(new Date(2020-03-01));
vo.setWorkFormalDay(new Date(2020-04-31));
vo.setAttendanceCount("22");
vo.setLeaveCount("2");
vo.setLateCount("1");
vo.setMinerCount("1");
vo.setLackCardCount("0");
vo.setWorkOverDay("2");
vo.setCompensatoryDay("10");
vo.setMarriageHoliday("10");
vo.setWinterHoliday("10");
vo.setPaternityLeaveDay("10");
holidayListVos.add(vo);
entity.setHolidayLists(holidayListVos);
// StaffEntity cache = this.service.getCache(entity.getWorkNum());
......
......@@ -29,6 +29,7 @@
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
<result property="remarkId" column="remarkId" />
<result property="source" column="source" />
</resultMap>
......@@ -109,6 +110,9 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remarkId') or colPickMode == 1 and data.containsKey('remarkId')))">
a.remarkId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('source') or colPickMode == 1 and data.containsKey('source')))">
a.source,
</if>
......@@ -117,18 +121,18 @@
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="StaffEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_staff
(name,gender,birthday,photoPath,phoneNumber,idCard,workNum,politicalstatus,deptId,deptName,positionId,positionName,staffType,status,registerPath,entryDate,regularDate,leaveDate,remark,createUserId,createTime,updateUserId,updateTime,source)
(name,gender,birthday,photoPath,phoneNumber,idCard,workNum,politicalstatus,deptId,deptName,positionId,positionName,staffType,status,registerPath,entryDate,regularDate,leaveDate,remark,createUserId,createTime,updateUserId,updateTime,remarkId,source)
VALUES
(#{name},#{gender},#{birthday},#{photoPath},#{phoneNumber},#{idCard},#{workNum},#{politicalstatus},#{deptId},#{deptName},#{positionId},#{positionName},#{staffType},#{status},#{registerPath},#{entryDate},#{regularDate},#{leaveDate},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{source})
(#{name},#{gender},#{birthday},#{photoPath},#{phoneNumber},#{idCard},#{workNum},#{politicalstatus},#{deptId},#{deptName},#{positionId},#{positionName},#{staffType},#{status},#{registerPath},#{entryDate},#{regularDate},#{leaveDate},#{remark},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{remarkId},#{source})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_staff
(name,gender,birthday,photoPath,phoneNumber,idCard,workNum,politicalstatus,deptId,deptName,positionId,positionName,staffType,status,registerPath,entryDate,regularDate,leaveDate,remark,createUserId,createTime,updateUserId,updateTime,source)
(name,gender,birthday,photoPath,phoneNumber,idCard,workNum,politicalstatus,deptId,deptName,positionId,positionName,staffType,status,registerPath,entryDate,regularDate,leaveDate,remark,createUserId,createTime,updateUserId,updateTime,remarkId,source)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.name},#{item.gender},#{item.birthday},#{item.photoPath},#{item.phoneNumber},#{item.idCard},#{item.workNum},#{item.politicalstatus},#{item.deptId},#{item.deptName},#{item.positionId},#{item.positionName},#{item.staffType},#{item.status},#{item.registerPath},#{item.entryDate},#{item.regularDate},#{item.leaveDate},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.source})
(#{item.name},#{item.gender},#{item.birthday},#{item.photoPath},#{item.phoneNumber},#{item.idCard},#{item.workNum},#{item.politicalstatus},#{item.deptId},#{item.deptName},#{item.positionId},#{item.positionName},#{item.staffType},#{item.status},#{item.registerPath},#{item.entryDate},#{item.regularDate},#{item.leaveDate},#{item.remark},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.remarkId},#{item.source})
</foreach>
</insert>
......@@ -231,6 +235,9 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
<if test="(colPickMode==0 and data.containsKey('remarkId')) or (colPickMode==1 and !data.containsKey('remarkId'))">
a.remarkId=#{data.remarkId},
</if>
<if test="(colPickMode==0 and data.containsKey('source')) or (colPickMode==1 and !data.containsKey('source'))">
a.source=#{data.source},
</if>
......@@ -450,6 +457,13 @@
</if>
</foreach>
</trim>
<trim prefix="remarkId=(case" suffix="ELSE remarkId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('remarkId')) or (colPickMode==1 and !item.containsKey('remarkId'))">
when a.id=#{item.id} then #{item.remarkId}
</if>
</foreach>
</trim>
<trim prefix="source=(case" suffix="ELSE source end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
......@@ -1100,6 +1114,27 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('remarkId')">
<if test="conditionParamRef.remarkId != null and conditionParamRef.remarkId != ''">
${_conditionType_} a.remarkId like #{${_conditionParam_}.remarkId}
</if>
<if test="conditionParamRef.remarkId == null">
${_conditionType_} a.remarkId is null
</if>
</if>
<if test="conditionParamRef.containsKey('remarkIdList')">
${_conditionType_} a.remarkId in
<foreach collection="conditionParamRef.remarkIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('remarkIdNotList')">
${_conditionType_} a.remarkId not in
<foreach collection="conditionParamRef.remarkIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('source')">
<if test="conditionParamRef.source != null ">
${_conditionType_} a.source = #{${_conditionParam_}.source}
......@@ -1260,6 +1295,11 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('remarkId')">
a.remarkId
<if test='orderCol.remarkId != null and "DESC".equalsIgnoreCase(orderCol.remarkId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('source')">
a.source
<if test='orderCol.source != null and "DESC".equalsIgnoreCase(orderCol.source)'>DESC</if>
......
......@@ -56,10 +56,11 @@ client.global.set("Staff_id", JSON.parse(response.body).data.id);
%}
###员工基本信息查看
GET {{baseUrl}}/staff/info?id={{Staff_id}}
GET {{baseUrl}}/staff/info?id=1
Authorization: {{authToken}}
Accept: application/json
###员工基本信息编辑
GET {{baseUrl}}/staff/edit?id={{Staff_id}}
Authorization: {{authToken}}
......
......@@ -14,9 +14,16 @@ INSERT INTO `mortals_xhx_resource` VALUES (null, '员工基本信息-菜单管
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '性别', 'Staff', 'gender', '1', '男', 1, 4, 0, 'gender', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '性别', 'Staff', 'gender', '2', '女', 1, 4, 0, 'gender', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '政治面貌 ', 'Staff', 'politicalstatus', '1', '中共党员', 1, 4, 0, 'politicalstatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '政治面貌 ', 'Staff', 'politicalstatus', '2', '中共预备党员', 1, 4, 0, 'politicalstatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '政治面貌 ', 'Staff', 'politicalstatus', '3', '共青团员', 1, 4, 0, 'politicalstatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '政治面貌 ', 'Staff', 'politicalstatus', '4', '群众', 1, 4, 0, 'politicalstatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '政治面貌 ', 'Staff', 'politicalstatus', '5', '其它', 1, 4, 0, 'politicalstatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '员工状态', 'Staff', 'status', '1', '正式', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '员工状态', 'Staff', 'status', '2', '试用', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '员工状态', 'Staff', 'status', '3', '离职', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '员工来源', 'Staff', 'source', '1', '外部', 1, 4, 0, 'source', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '员工来源', 'Staff', 'source', '2', '内部', 1, 4, 0, 'source', NULL, NULL, NULL);
-- ----------------------------
-- 员工关怀信息菜单 SQL
-- ----------------------------
......
......@@ -26,36 +26,38 @@ CREATE TABLE `mortals_xhx_dept` (
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_staff`;
CREATE TABLE mortals_xhx_staff(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`name` varchar(64) NOT NULL COMMENT '员工姓名',
`gender` tinyint(2) DEFAULT '1' COMMENT '性别(1.男,2.女)',
`birthday` datetime COMMENT '出生日期',
`photoPath` varchar(255) COMMENT '照片',
`phoneNumber` varchar(128) COMMENT '联系电话',
`idCard` varchar(128) COMMENT '身份证号码',
`workNum` varchar(128) COMMENT '工号',
`politicalstatus` tinyint(2) DEFAULT '1' COMMENT '政治面貌 (1.中共党员,2.中共预备党员,3.共青团员,4.群众,5.其它)',
`deptId` bigint(20) COMMENT '所属部门',
`deptName` varchar(128) COMMENT '所属部门名称',
`positionId` bigint(20) COMMENT '职位ID',
`positionName` varchar(128) COMMENT '职位名称',
`staffType` tinyint(2) DEFAULT '1' COMMENT '员工类型(1.全职,2.兼职,3.实习)',
`status` tinyint(2) DEFAULT '1' COMMENT '员工状态(1.正式,2.试用,3.离职)',
`registerPath` varchar(255) COMMENT '入职登记表',
`entryDate` datetime COMMENT '入职时间',
`regularDate` datetime COMMENT '转正时间',
`leaveDate` datetime COMMENT '离职时间',
`remark` varchar(255) COMMENT '备注',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
`source` tinyint(2) DEFAULT '1' COMMENT '员工来源(1.外部,2.内部)',
PRIMARY KEY (`id`)
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`name` varchar(64) NOT NULL COMMENT '员工姓名',
`gender` tinyint(2) DEFAULT '1' COMMENT '性别(1.男,2.女)',
`birthday` datetime COMMENT '出生日期',
`photoPath` varchar(255) COMMENT '照片',
`phoneNumber` varchar(128) COMMENT '联系电话',
`idCard` varchar(128) COMMENT '身份证号码',
`workNum` varchar(128) COMMENT '工号',
`politicalstatus` tinyint(2) DEFAULT '1' COMMENT '政治面貌 (1.中共党员,2.中共预备党员,3.共青团员,4.群众,5.其它)',
`deptId` bigint(20) COMMENT '所属部门',
`deptName` varchar(128) COMMENT '所属部门名称',
`positionId` bigint(20) COMMENT '职位ID',
`positionName` varchar(128) COMMENT '职位名称',
`staffType` tinyint(2) DEFAULT '1' COMMENT '员工类型(1.全职,2.兼职,3.实习)',
`status` tinyint(2) DEFAULT '1' COMMENT '员工状态(1.正式,2.试用,3.离职)',
`registerPath` varchar(255) COMMENT '入职登记表',
`entryDate` datetime COMMENT '入职时间',
`regularDate` datetime COMMENT '转正时间',
`leaveDate` datetime COMMENT '离职时间',
`remark` varchar(255) COMMENT '备注',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
`remarkId` varchar(255) COMMENT '备注id',
`source` tinyint(2) DEFAULT '1' COMMENT '员工来源(1.外部,2.内部)',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工基本信息';
-- ----------------------------
-- 员工关怀信息表
-- ----------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment