中建五局-人员新增、修改、删除、查询接口编写
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,10 +15,7 @@ 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;
|
||||
@ -38,9 +37,9 @@ public class SystemUserController {
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@ -62,6 +61,7 @@ public class SystemUserController {
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@ -75,6 +75,7 @@ public class SystemUserController {
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param systemUser
|
||||
* @return
|
||||
*/
|
||||
@ -88,6 +89,7 @@ public class SystemUserController {
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ -111,9 +113,9 @@ public class SystemUserController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ -183,4 +185,28 @@ public class SystemUserController {
|
||||
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>
|
||||
<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;
|
||||
|
||||
@ -58,8 +58,11 @@ public class QualityRectifyRecordController {
|
||||
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,6 +4,8 @@ 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;
|
||||
|
||||
@ -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