中建五局-人员新增、修改、删除、查询接口编写
This commit is contained in:
parent
6e4235364b
commit
4cbf0772eb
2
pom.xml
2
pom.xml
@ -333,7 +333,7 @@
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi-web</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.3.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
@ -13,20 +15,17 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 账号
|
||||
* @author: pds
|
||||
* @date: 2020-08-06
|
||||
* @date: 2020-08-06
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@ -34,153 +33,180 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Api(tags = "账号")
|
||||
public class SystemUserController {
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理",operType = "添加账号",operDesc = "添加账号")
|
||||
@ApiOperation(value = " 添加账号信息", notes = "添加账号信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<SystemUser> add(@RequestBody SystemUser systemUser) {
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理", operType = "添加账号", operDesc = "添加账号")
|
||||
@ApiOperation(value = " 添加账号信息", notes = "添加账号信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<SystemUser> add(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.saveSystemUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "账号管理",operType = "添加项目子账号",operDesc = "添加项目子账号")
|
||||
@ApiOperation(value = " 添加项目子账号信息", notes = "添加项目子账号信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/addProjectUser")
|
||||
public Result<SystemUser> addProjectUser(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.addProjectUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理",operType = "编辑账号信息",operDesc = "编辑账号信息")
|
||||
@ApiOperation(value = "编辑账号信息", notes = "编辑账号信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<SystemUser> edit(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.editSystemUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
@OperLog(operModul = "账号管理", operType = "添加项目子账号", operDesc = "添加项目子账号")
|
||||
@ApiOperation(value = " 添加项目子账号信息", notes = "添加项目子账号信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/addProjectUser")
|
||||
public Result<SystemUser> addProjectUser(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.addProjectUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理",operType = "编辑账号信息",operDesc = "编辑账号信息")
|
||||
@ApiOperation(value = "编辑账号信息", notes = "编辑账号信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/editProjectUser")
|
||||
public Result<SystemUser> editProjectUser(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.editProjectUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理",operType = "删除账号信息",operDesc = "删除账号信息")
|
||||
@ApiOperation(value = "删除账号信息", notes = "删除账号信息" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "id", value = "账号ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<SystemUser> delete(@RequestBody Map<String,Object> map) {
|
||||
Result<SystemUser> result = new Result<SystemUser>();
|
||||
SystemUser systemUser = systemUserService.getById(MapUtils.getString(map,"id"));
|
||||
if(systemUser==null) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
}else {
|
||||
boolean ok = systemUserService.removeById(MapUtils.getString(map,"id"));
|
||||
if(ok) {
|
||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理", operType = "编辑账号信息", operDesc = "编辑账号信息")
|
||||
@ApiOperation(value = "编辑账号信息", notes = "编辑账号信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<SystemUser> edit(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.editSystemUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询账号信息", notes = "通过id查询账号信息" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "id", value = "账号ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<SystemUser> queryById(@RequestBody Map<String,Object> map) {
|
||||
Result<SystemUser> result = new Result<SystemUser>();
|
||||
SystemUser systemUser = systemUserService.getById(MapUtils.getString(map,"id"));
|
||||
if(systemUser==null) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
}else {
|
||||
result.setResult(systemUser);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理", operType = "编辑账号信息", operDesc = "编辑账号信息")
|
||||
@ApiOperation(value = "编辑账号信息", notes = "编辑账号信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/editProjectUser")
|
||||
public Result<SystemUser> editProjectUser(@RequestBody SystemUser systemUser) {
|
||||
systemUserService.editProjectUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@OperLog(operModul = "账号管理",operType = "修改用户密码",operDesc = "修改用户密码")
|
||||
@ApiOperation(value = "修改用户密码", notes = "修改用户密码", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "人员账号userID", paramType = "form"),
|
||||
@ApiImplicitParam(name = "passWord", required = true, value = "新密码", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/updateUserPassWord")
|
||||
public Result updateUserPassWord(@RequestBody Map<String,Object> map) {
|
||||
systemUserService.updateUserPassWord(map);
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "账号管理", operType = "删除账号信息", operDesc = "删除账号信息")
|
||||
@ApiOperation(value = "删除账号信息", notes = "删除账号信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "账号ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<SystemUser> delete(@RequestBody Map<String, Object> map) {
|
||||
Result<SystemUser> result = new Result<SystemUser>();
|
||||
SystemUser systemUser = systemUserService.getById(MapUtils.getString(map, "id"));
|
||||
if (systemUser == null) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
} else {
|
||||
boolean ok = systemUserService.removeById(MapUtils.getString(map, "id"));
|
||||
if (ok) {
|
||||
result.successMsg(MessageUtil.get("deleteSucess"));
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据企业或项目SN查找账号列表", notes = "根据企业或项目SN查找账号列表", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "sn", required = true, value = "企业或项目SN", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/getSystemUserBySn")
|
||||
public Result<List<SystemUser>> getSystemUserBySn(@RequestBody Map<String,Object> map) {
|
||||
return Result.success(systemUserService.getSystemUserBySn(map));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查找项目子账号列表", notes = "查找项目子账号列表", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", required = true, value = "项目SN", paramType = "form"),
|
||||
@ApiImplicitParam(name = "workerName", required = false, value = "姓名", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/getProjectChilderSystemUserList")
|
||||
public Result<List<EntityMap>> getProjectChilderSystemUserList(@RequestBody Map<String,Object> map) {
|
||||
return Result.success(systemUserService.getProjectChilderSystemUserList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发送安全帽平台账号信息", notes = "发送安全帽平台账号信息", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "用户ID", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/sendSafetyHatAccountData")
|
||||
public Result sendSafetyHatAccountData(@RequestBody Map<String,Object> map) {
|
||||
systemUserService.sendSafetyHatAccountData(map);
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询账号信息", notes = "通过id查询账号信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "账号ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<SystemUser> queryById(@RequestBody Map<String, Object> map) {
|
||||
Result<SystemUser> result = new Result<SystemUser>();
|
||||
SystemUser systemUser = systemUserService.getById(MapUtils.getString(map, "id"));
|
||||
if (systemUser == null) {
|
||||
result.error500(MessageUtil.get("notFindErr"));
|
||||
} else {
|
||||
result.setResult(systemUser);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发送安全帽平台项目信息", notes = "发送安全帽平台项目信息", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", required = true, value = "项目sn", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/sendSafetyHatProjectData")
|
||||
public Result sendSafetyHatProjectData(@RequestBody Map<String,Object> map) {
|
||||
systemUserService.sendSafetyHatProjectData(map);
|
||||
return Result.ok();
|
||||
}
|
||||
@OperLog(operModul = "账号管理", operType = "修改用户密码", operDesc = "修改用户密码")
|
||||
@ApiOperation(value = "修改用户密码", notes = "修改用户密码", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "人员账号userID", paramType = "form"),
|
||||
@ApiImplicitParam(name = "passWord", required = true, value = "新密码", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/updateUserPassWord")
|
||||
public Result updateUserPassWord(@RequestBody Map<String, Object> map) {
|
||||
systemUserService.updateUserPassWord(map);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据企业或项目SN查找账号列表", notes = "根据企业或项目SN查找账号列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "sn", required = true, value = "企业或项目SN", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/getSystemUserBySn")
|
||||
public Result<List<SystemUser>> getSystemUserBySn(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(systemUserService.getSystemUserBySn(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查找项目子账号列表", notes = "查找项目子账号列表", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", required = true, value = "项目SN", paramType = "form"),
|
||||
@ApiImplicitParam(name = "workerName", required = false, value = "姓名", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/getProjectChilderSystemUserList")
|
||||
public Result<List<EntityMap>> getProjectChilderSystemUserList(@RequestBody Map<String, Object> map) {
|
||||
return Result.success(systemUserService.getProjectChilderSystemUserList(map));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发送安全帽平台账号信息", notes = "发送安全帽平台账号信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "userId", required = true, value = "用户ID", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/sendSafetyHatAccountData")
|
||||
public Result sendSafetyHatAccountData(@RequestBody Map<String, Object> map) {
|
||||
systemUserService.sendSafetyHatAccountData(map);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "发送安全帽平台项目信息", notes = "发送安全帽平台项目信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", required = true, value = "项目sn", paramType = "form"),
|
||||
})
|
||||
@PostMapping(value = "/sendSafetyHatProjectData")
|
||||
public Result sendSafetyHatProjectData(@RequestBody Map<String, Object> map) {
|
||||
systemUserService.sendSafetyHatProjectData(map);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "中建五局查询人员分页列表", notes = "中建五局查询人员分页列表", httpMethod = "GET")
|
||||
@GetMapping(value = "/zjwj/page")
|
||||
public Result<IPage<SystemUser>> getZjwjUserPage(SystemUser systemUser) {
|
||||
return systemUserService.getZjwjUserPage(systemUser);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "中建五局新增人员", notes = "中建五局新增人员", httpMethod = "POST")
|
||||
@PostMapping(value = "/zjwj/add")
|
||||
public Result addZjwjUser(@RequestBody SystemUser systemUser) {
|
||||
return systemUserService.addZjwjUser(systemUser);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "中建五局修改人员", notes = "中建五局修改人员", httpMethod = "POST")
|
||||
@PostMapping(value = "/zjwj/update")
|
||||
public Result updateZjwjUser(@RequestBody SystemUser systemUser) {
|
||||
return systemUserService.updateZjwjUser(systemUser);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "中建五局删除人员", notes = "中建五局删除人员", httpMethod = "POST")
|
||||
@PostMapping(value = "/zjwj/delete")
|
||||
public Result deleteZjwjUser(@RequestBody SystemUser systemUser) {
|
||||
return systemUserService.deleteZjwjUser(systemUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -124,4 +125,13 @@ public class SystemUser implements Serializable {
|
||||
* 三江统一登录的组织ids
|
||||
*/
|
||||
private String sjUnifiedAuthenticationOrgIds;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String projectSn;
|
||||
|
||||
@TableField(exist = false)
|
||||
private WorkerInfo workerInfo;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long departmentId;
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -42,4 +44,6 @@ public interface SystemUserMapper extends BaseMapper<SystemUser> {
|
||||
List<SystemUser> selectProjectSystemUserListBySnSet(@Param("projectSnSet") Set<String> projectSnSet);
|
||||
|
||||
List<SystemUser> selectBySnAndNumberOneList(@Param("sn") String sn, @Param("userNameSet") Set<String> userNameSet);
|
||||
|
||||
IPage<SystemUser> getZjwjUserPage(Page<SystemUser> p, SystemUser systemUser);
|
||||
}
|
||||
|
||||
@ -121,4 +121,42 @@
|
||||
group by `real_name`
|
||||
HAVING COUNT(real_name) = 1
|
||||
</select>
|
||||
</mapper>
|
||||
<resultMap id="zjwjUserPage" type="com.zhgd.xmgl.modules.basicdata.entity.SystemUser" autoMapping="true">
|
||||
<id column="user_id" property="userId"/>
|
||||
<association property="workerInfo" javaType="com.zhgd.xmgl.modules.worker.entity.WorkerInfo" autoMapping="true">
|
||||
<id column="wi_id" property="id"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
<select id="getZjwjUserPage" resultMap="zjwjUserPage">
|
||||
SELECT
|
||||
su.user_id,
|
||||
su.account,
|
||||
su.`password`,
|
||||
su.show_password,
|
||||
su.create_time,
|
||||
su.real_name,
|
||||
su.user_tel,
|
||||
su.department,
|
||||
su.sn,
|
||||
su.account_type,
|
||||
su.worker_id,
|
||||
su.job_id,
|
||||
su.external_account,
|
||||
su.client_id,
|
||||
su.sj_unified_authentication_user_id,
|
||||
su.sj_unified_authentication_org_ids,
|
||||
di.department_name,
|
||||
di.id,
|
||||
di.project_sn,
|
||||
di.enterprise_id,
|
||||
wi.id as wi_id
|
||||
FROM
|
||||
system_user AS su
|
||||
INNER JOIN worker_info AS wi ON wi.id = su.worker_id
|
||||
INNER JOIN department_info AS di ON di.id = wi.department_id
|
||||
where wi.project_sn = #{projectSn}
|
||||
<if test="departmentId != null">
|
||||
AND di.id=#{departmentId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.entity.sj.JwtPayloadUserInfo;
|
||||
@ -51,4 +53,12 @@ public interface ISystemUserService extends IService<SystemUser> {
|
||||
|
||||
|
||||
Result sjLogin(JwtPayloadUserInfo jwtPayloadUserInfo);
|
||||
|
||||
Result<IPage<SystemUser>> getZjwjUserPage(SystemUser systemUser);
|
||||
|
||||
Result addZjwjUser(SystemUser systemUser);
|
||||
|
||||
Result updateZjwjUser(SystemUser systemUser);
|
||||
|
||||
Result deleteZjwjUser(SystemUser systemUser);
|
||||
}
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gexin.fastjson.JSON;
|
||||
import com.zhgd.exception.CustomException;
|
||||
@ -882,4 +886,37 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
Map<String, Object> rsMap = doLogin(map, systemUser);
|
||||
return Result.success(rsMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<IPage<SystemUser>> getZjwjUserPage(SystemUser systemUser) {
|
||||
Page<SystemUser> p = new Page<>();
|
||||
IPage<SystemUser> page = systemUserMapper.getZjwjUserPage(p, systemUser);
|
||||
return Result.success(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addZjwjUser(SystemUser systemUser) {
|
||||
addProjectUser(systemUser);
|
||||
WorkerInfo workerInfo = new WorkerInfo();
|
||||
workerInfo.setIdCard(IdUtil.fastSimpleUUID());
|
||||
workerInfo.setProjectSn(systemUser.getProjectSn());
|
||||
workerInfo.setAddTime(new Date());
|
||||
workerInfo.setDepartmentId(systemUser.getDepartmentId());
|
||||
workerInfoMapper.insert(workerInfo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateZjwjUser(SystemUser systemUser) {
|
||||
editSystemUser(systemUser);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result deleteZjwjUser(SystemUser systemUser) {
|
||||
SystemUser su = systemUserMapper.selectById(systemUser);
|
||||
systemUserMapper.deleteById(systemUser);
|
||||
workerInfoMapper.deleteById(su.getWorkerId());
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
package com.zhgd.xmgl.modules.quality.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialDevice;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
||||
import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto;
|
||||
import com.zhgd.xmgl.modules.quality.entity.vo.AllAndThisWeekDataVO;
|
||||
@ -17,10 +22,18 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -4,17 +4,17 @@ import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRectifyRecord;
|
||||
import com.zhgd.xmgl.modules.quality.entity.vo.DepartmentRectifiedRankVo;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRectifyRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -33,7 +33,7 @@ import java.util.Map;
|
||||
public class QualityRectifyRecordController {
|
||||
@Autowired
|
||||
private IQualityRectifyRecordService qualityRectifyRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @return
|
||||
@ -44,22 +44,25 @@ public class QualityRectifyRecordController {
|
||||
public Result<List<EntityMap>> selectRectifyRecordList(@RequestBody Map<String,Object> map) {
|
||||
return Result.success(qualityRectifyRecordService.selectRectifyRecordList(map));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param qualityRectifyRecord
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "质量管理",operType = "添加质量检查整改/复查记录信息",operDesc = "添加质量检查整改/复查记录信息")
|
||||
@ApiOperation(value = " 添加质量检查-整改/复查记录信息", notes = "添加质量检查-整改/复查记录信息" , httpMethod="POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<QualityRectifyRecord> add(@RequestBody QualityRectifyRecord qualityRectifyRecord) {
|
||||
qualityRectifyRecordService.saveQualityRectifyRecord(qualityRectifyRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
* @param qualityRectifyRecord
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "质量管理", operType = "添加质量检查整改/复查记录信息", operDesc = "添加质量检查整改/复查记录信息")
|
||||
@ApiOperation(value = " 添加质量检查-整改/复查记录信息", notes = "添加质量检查-整改/复查记录信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<QualityRectifyRecord> add(@RequestBody QualityRectifyRecord qualityRectifyRecord) {
|
||||
qualityRectifyRecordService.saveQualityRectifyRecord(qualityRectifyRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出质量问题和整改记录excel", notes = "导出质量问题和整改记录excel", httpMethod = "GET")
|
||||
@GetMapping(value = "/recordRectify/excel/export")
|
||||
public void qualityInspectionRecordRectifyExportExcel(@RequestParam String projectSn, HttpServletResponse response) throws IOException {
|
||||
qualityRectifyRecordService.qualityInspectionRecordRectifyExportExcel(projectSn, response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,13 +4,15 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityRectifyRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 质量检查-整改记录
|
||||
* @author: pds
|
||||
* @date: 2021-06-17
|
||||
* @date: 2021-06-17
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IQualityRectifyRecordService extends IService<QualityRectifyRecord> {
|
||||
@ -18,4 +20,6 @@ public interface IQualityRectifyRecordService extends IService<QualityRectifyRec
|
||||
List<EntityMap> selectRectifyRecordList(Map<String, Object> map);
|
||||
|
||||
void saveQualityRectifyRecord(QualityRectifyRecord qualityRectifyRecord);
|
||||
|
||||
void qualityInspectionRecordRectifyExportExcel(String projectSn, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@ -9,14 +9,21 @@ import com.zhgd.xmgl.modules.quality.entity.QualityRectifyRecord;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityInspectionRecordMapper;
|
||||
import com.zhgd.xmgl.modules.quality.mapper.QualityRectifyRecordMapper;
|
||||
import com.zhgd.xmgl.modules.quality.service.IQualityRectifyRecordService;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 质量检查-整改记录
|
||||
@ -81,4 +88,40 @@ public class QualityRectifyRecordServiceImpl extends ServiceImpl<QualityRectifyR
|
||||
sanjiangDataCall.sendUpdateQualityInspectionRecord(qualityInspectionRecord);
|
||||
sanjiangDataCall.sendAddQualityRectifyRecord(qualityRectifyRecord, qualityInspectionRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void qualityInspectionRecordRectifyExportExcel(String projectSn, HttpServletResponse response) throws IOException {
|
||||
String templatePath = "zjwj/template/qualityInspectionRecordRectifyTemplate.xls";
|
||||
String path = getClass().getClassLoader().getResource(templatePath).getPath();
|
||||
TemplateExportParams params = new TemplateExportParams(path);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("title", "员工信息");
|
||||
List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Map<String, Object> lm = new HashMap<String, Object>();
|
||||
lm.put("name", "王" + i);
|
||||
lm.put("age", "2" + i);
|
||||
lm.put("sex", i % 2 == 0 ? "1" : "2");
|
||||
lm.put("date", new Date());
|
||||
lm.put("salary", 1000 + i);
|
||||
listMap.add(lm);
|
||||
}
|
||||
map.put("maplist", listMap);
|
||||
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
|
||||
|
||||
//准备将Excel的输出流通过response输出到页面下载
|
||||
//八进制输出流
|
||||
response.setContentType("application/octet-stream");
|
||||
|
||||
//这后面可以设置导出Excel的名称,此例中名为student.xls
|
||||
response.setHeader("Content-disposition", "attachment;filename=export.xls");
|
||||
|
||||
//刷新缓冲
|
||||
response.flushBuffer();
|
||||
|
||||
//workbook将Excel写入到response的输出流中,供页面下载
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,6 +343,9 @@ public class WorkerInfo implements Serializable {
|
||||
@ApiModelProperty(value = "工种名称")
|
||||
private String teamName;
|
||||
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
@TableField(exist = false)
|
||||
private java.lang.String departmentName;
|
||||
|
||||
public String toExistString() {
|
||||
return "WorkerInfo{" +
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user