Commit 9cdb0262 authored by 赵啸非's avatar 赵啸非

添加窗口人员查询

parent d87c137c
......@@ -16,4 +16,6 @@ import java.util.Date;
@Data
public class WindowOwnerVo extends BaseEntityLong {
private Long windowId;
}
\ No newline at end of file
package com.mortals.xhx.module.window.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.model.WindowOwnerEntity;
import com.mortals.xhx.module.window.dao.WindowOwnerDao;
......@@ -35,4 +37,8 @@ public interface WindowOwnerService extends ICRUDService<WindowOwnerEntity,Long>
* @return
*/
List<WindowOwnerDetailEntity> ownerWindowList(Context context);
Rest<List<StaffEntity>> getWindowPerson(Long windowId, Context context);
}
\ No newline at end of file
package com.mortals.xhx.module.window.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.common.pdu.workman.WorkmanPdu;
import com.mortals.xhx.feign.window.IWindowFeign;
import com.mortals.xhx.feign.workman.IWorkmanFeign;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......@@ -25,6 +31,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
......@@ -43,9 +50,14 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
private WindowOwnerDetailService windowOwnerDetailService;
@Autowired
private IWindowFeign windowFeign;
@Autowired
private StaffService staffService;
@Autowired
private UserService userService;
@Autowired
private IWorkmanFeign workmanFeign;
@Override
......@@ -94,6 +106,46 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
return windowOwnerDetailEntities;
}
@Override
public Rest<List<StaffEntity>> getWindowPerson(Long windowId, Context context) {
WorkmanPdu workmanPdu = new WorkmanPdu();
workmanPdu.setWindowId(windowId);
Rest<RespData<List<WorkmanPdu>>> rest = workmanFeign.list(workmanPdu);
if (rest.getCode() == YesNoEnum.YES.getValue()) {
List<StaffEntity> staffEntityList = rest.getData().getData().stream().map(item -> {
//转换成staf
String name = item.getName();
String mobile = item.getMobile();
if (!ObjectUtils.isEmpty(mobile)) {
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(mobile));
if (!ObjectUtils.isEmpty(staffEntity)) {
return staffEntity;
} else {
}
return getStaffEntityByName(name);
} else if (!ObjectUtils.isEmpty(name)) {
//通过名字查找
return getStaffEntityByName(name);
} else {
log.info("未找到对应员工:{}", JSON.toJSONString(item));
return null;
}
}).collect(Collectors.toList());
return Rest.ok(staffEntityList);
}
return Rest.fail("获取窗口工作人员失败");
}
private StaffEntity getStaffEntityByName(String name) {
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().name(name));
if (!ObjectUtils.isEmpty(staffEntity)) {
return staffEntity;
} else {
return null;
}
}
@Override
protected void saveBefore(WindowOwnerEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
......
......@@ -6,9 +6,7 @@ import com.mortals.xhx.module.check.model.CheckWindowPerformQuery;
import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformEntity;
import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformQuery;
import com.mortals.xhx.module.check.service.CheckWindowPerformService;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformDetailEntity;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformDetailQuery;
import com.mortals.xhx.module.window.model.WindowWorkmanPerformEntity;
import com.mortals.xhx.module.window.model.*;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -17,9 +15,9 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.window.dao.WindowPerformDao;
import com.mortals.xhx.module.window.model.WindowPerformEntity;
import com.mortals.xhx.module.window.service.WindowPerformService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.Date;
......@@ -39,8 +37,38 @@ public class WindowPerformServiceImpl extends AbstractCRUDServiceImpl<WindowPerf
@Autowired
private CheckWindowPerformService checkWindowPerformService;
@Override
protected void saveBefore(WindowPerformEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
deleteExistBill(entity, context);
}
private void deleteExistBill(WindowPerformEntity entity, Context context) {
WindowPerformEntity windowPerformEntity = this.selectOne(new WindowPerformQuery()
.year(entity.getYear())
.month(entity.getMonth())
.windowId(entity.getWindowId())
.fillStatus(FillStatusEnum.提交.getValue()));
if(!ObjectUtils.isEmpty(windowPerformEntity)&& entity.getFillStatus()== FillStatusEnum.提交.getValue()){
this.remove(Arrays.asList(windowPerformEntity.getId()), context);
//删除
}
}
@Override
protected void updateBefore(WindowPerformEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
deleteExistBill(entity, context);
}
@Override
protected void saveAfter(WindowPerformEntity entity, Context context) throws AppException {
//对同一个窗口的同一时间只能有一个窗口进行操作
if(entity.getFillStatus()== FillStatusEnum.提交.getValue()){
saveToCheck(entity);
}
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.module.window.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.site.model.SiteQuery;
......@@ -15,6 +16,7 @@ import com.mortals.xhx.feign.site.ISiteHallFeign;
import com.mortals.xhx.feign.window.IWindowFeign;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -144,4 +146,32 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
}
/**
* 查询窗口人员列表
*/
@PostMapping(value = "windowPerson")
@UnAuth
public String getWindowPerson(@RequestBody WindowOwnerEntity query) {
JSONObject jsonObject = new JSONObject();
String busiDesc = "查询窗口人员列表" + this.getModuleDesc();
try {
if (ObjectUtils.isEmpty(query.getWindowId())) throw new AppException("窗口ID不能为空!");
Rest<List<StaffEntity>> windowPersonRest = this.service.getWindowPerson(query.getWindowId(), getContext());
if (YesNoEnum.YES.getValue() == windowPersonRest.getCode()) {
jsonObject.put(KEY_RESULT_DATA, windowPersonRest.getData());
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询当前负责人负责的窗口列表!");
recordSysLog(request, busiDesc + " 【成功】");
} else {
throw new AppException(windowPersonRest.getMsg());
}
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.window.dao.ibatis.WindowWorkmanPerformDaoImpl">
<!-- 字段和属性映射 -->
......@@ -25,10 +25,10 @@
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
<collection property="workmanPerformDetailList" column="id" ofType="WindowWorkmanPerformDetailEntity" javaType="ArrayList" select="getWorkmanPerformDetailByPerformId"></collection>
<collection property="windowWorkmanPerformDetailList" column="id" ofType="WindowWorkmanPerformDetailEntity" javaType="ArrayList" select="getWindowWorkmanPerformDetailByPerformId"></collection>
</resultMap>
<resultMap type="WindowWorkmanPerformDetailEntity" id="WindowWorkmanPerformDetailEntity-Map">
<id property="id" column="id" />
<result property="id" column="id" />
<result property="performId" column="performId" />
<result property="staffId" column="staffId" />
<result property="staffName" column="staffName" />
......@@ -45,9 +45,9 @@
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
<trim suffixOverrides="," suffix="">
......@@ -116,7 +116,7 @@
<!-- 子表所有列 -->
<sql id="_columns_sub">
<trim suffixOverrides="," suffix="">
b.id,b.ownerId,b.staffId,b.remark,b.createTime,b.createUserId,b.updateUserId,b.updateTime,
b.id,b.performId,b.staffId,b.staffName,b.discipline,b.specification,b.management,b.evaluation,b.efficiency,b.bonusScore,b.sumScore,b.examineLevel,b.remark,b.createUserId,b.createTime,b.updateUserId,b.updateTime,
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
......@@ -477,9 +477,8 @@
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取子列表 -->
<select id="getWorkmanPerformDetailByPerformId" parameterType="java.lang.Long" resultMap="WindowWorkmanPerformDetailEntity-Map">
<select id="getWindowWorkmanPerformDetailByPerformId" parameterType="java.lang.Long" resultMap="WindowWorkmanPerformDetailEntity-Map">
select <include refid="_columns_sub"/>
from mortals_xhx_window_workman_perform_detail as b
<trim suffixOverrides="where" suffix="">
......@@ -487,6 +486,8 @@
</trim>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
select count(1)
......
package com.mortals.xhx.common.pdu.workman;
import java.util.Date;
import java.util.List;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
/**
* 工作人员Pdu对象
*
* @author zxfei
* @date 2024-01-27
*/
@Data
public class WorkmanPdu extends BaseEntityLong {
private static final long serialVersionUID = 1L;
/**
* 登录用户名
*/
private String loginName;
/**
* 密码
*/
private String loginPwd;
/**
* 部门id号
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
/**
* 窗口id号
*/
private Long windowId;
/**
* 窗口名称
*/
private String windowName;
/**
* 站点ID
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 姓名
*/
private String name;
/**
* 工号
*/
private String number;
/**
* 职务
*/
private String userpost;
/**
* 职称
*/
private String posttitle;
/**
* 政治面貌 (0.中共党员,1.中共预备党员,2.共青团员,3.普通居民,4.其它)
*/
private Integer politicalstatus;
/**
* 党员 (0.非党员,1.党员,2.党员示范岗,3.党员先锋岗)
*/
private Integer dangyuan;
/**
* 党员扩展
*/
private String dangyuanext;
/**
* 身份证
*/
private String idCard;
/**
* 电话
*/
private String phone;
/**
* 手机
*/
private String mobile;
/**
* 星级
*/
private Integer starlevel;
/**
* 个人简介
*/
private String summary;
/**
* 照片
*/
private String photoPath;
/**
* 岗位职责
*/
private String duty;
/**
* 服务承诺
*/
private String promise;
/**
* 办理事项
*/
private String business;
/**
* 是否在线(0.离线,1.在线,2.暂离,3.点击暂离,4.回归,5.登陆)
*/
private Integer online;
/**
* 配置站点模块,逗号分隔
*/
private String modelIds;
/**
* 最后一次登录时间
*/
private Date lastLoginTime;
/**
* 最后一次登录地址
*/
private String lastLoginAddress;
/**
* 一体化经办人id
*/
private String operatorId;
public void initAttrValue(){
this.loginName = "";
this.loginPwd = "";
this.deptId = null;
this.deptName = "";
this.windowId = null;
this.windowName = "";
this.siteId = null;
this.siteName = "";
this.name = "";
this.number = "";
this.userpost = "";
this.posttitle = "";
this.politicalstatus = 0;
this.dangyuan = 0;
this.dangyuanext = "";
this.idCard = "";
this.phone = "";
this.mobile = "";
this.starlevel = 0;
this.summary = "";
this.photoPath = "";
this.duty = null;
this.promise = null;
this.business = null;
this.online = 1;
this.modelIds = "";
this.lastLoginTime = null;
this.lastLoginAddress = null;
this.operatorId = "";
}
}
\ No newline at end of file
package com.mortals.xhx.feign.workman;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.workman.WorkmanPdu;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 工作人员 Feign接口
* @author zxfei
* @date 2024-01-27
*/
@FeignClient(name = "base-manager", path = "/base", fallbackFactory = WorkmanFeignFallbackFactory.class)
public interface IWorkmanFeign extends IFeign {
/**
* 查看工作人员列表
*
* @param workmanPdu
* @return
*/
@PostMapping(value = "/workman/interlist")
Rest<RespData<List<WorkmanPdu>>> list(@RequestBody WorkmanPdu workmanPdu);
/**
* 查看工作人员
*
* @param id
* @return
*/
@GetMapping(value = "/workman/interinfo")
Rest<WorkmanPdu> info(@RequestParam(value = "id") Long id);
/**
* 删除工作人员
*
* @param ids
* @return
*/
@GetMapping(value = "/workman/delete")
Rest<Void> delete(Long[] ids,@RequestHeader("Authorization") String authorization);
/**
* 工作人员保存更新
*
* @param workmanPdu
* @return
*/
@PostMapping(value = "/workman/save")
Rest<RespData<WorkmanPdu>> save(@RequestBody WorkmanPdu workmanPdu,@RequestHeader("Authorization") String authorization);
}
@Slf4j
@Component
class WorkmanFeignFallbackFactory implements FallbackFactory<IWorkmanFeign> {
@Override
public IWorkmanFeign create(Throwable t) {
return new IWorkmanFeign() {
@Override
public Rest<RespData<List<WorkmanPdu>>> list(WorkmanPdu workmanPdu) {
return Rest.fail("暂时无法获取工作人员列表,请稍后再试!");
}
@Override
public Rest<WorkmanPdu> info(Long id) {
return Rest.fail("暂时无法获取工作人员详细,请稍后再试!");
}
@Override
public Rest<Void> delete(Long[] ids, String authorization) {
return Rest.fail("暂时无法删除工作人员,请稍后再试!");
}
@Override
public Rest<RespData<WorkmanPdu>> save(WorkmanPdu workmanPdu, String authorization) {
return Rest.fail("暂时无法保存工作人员,请稍后再试!");
}
};
}
}
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