Commit b01afe4c authored by 竹天卫's avatar 竹天卫

委托管理优化

parent a36406ed
......@@ -53,6 +53,16 @@ public class EntrustController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "置顶")
@PostMapping("/setTopping")
public BaseResponse setTopping(Integer id) {
try {
return entrustService.setTopping(id);
}catch (Exception e) {
log.debug("置顶{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "新增委托")
@PostMapping("/create")
......
......@@ -29,7 +29,7 @@ import javax.servlet.http.HttpServletResponse;
* @author ztw
* @since 2020-08-18
*/
@Api(tags = "配置管理-检测标准配置")
@Api(tags = "配置管理-检测依据配置")
@RestController
@RequestMapping("/business/method")
public class MethodController {
......@@ -38,33 +38,33 @@ public class MethodController {
@Autowired
private IMethodService methodService;
@ApiOperation(value = "检测标准分页列表")
@ApiOperation(value = "检测依据分页列表")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "name", value = "标准名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "standard", value = "标准号", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "name", value = "检测依据名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "standard", value = "依据号", paramType = "query", dataType = "String")
})
@GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, String name, String standard) {
try {
return methodService.getPage(pageQuery, name, standard);
} catch (Exception e) {
log.debug("检测标准分页列表{}", e);
log.debug("检测依据分页列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation("检测标准导出")
@ApiOperation("检测依据导出")
@PostMapping("/export")
public void export(String name, String standard, String fileName, HttpServletResponse response) {
try {
methodService.export(name, standard, fileName, response);
} catch (Exception e) {
log.debug("检测标准导出{}", e);
log.debug("检测依据导出{}", e);
}
}
@ApiOperation(value = "检测标准详情")
@ApiOperation(value = "检测依据详情")
@GetMapping("/{id}")
public BaseResponse getById(@PathVariable Integer id){
try {
......@@ -74,53 +74,53 @@ public class MethodController {
}
return BaseResponse.okData(e);
}catch (Exception e){
log.debug("检测标准详情{}",e);
log.debug("检测依据详情{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测标准列表")
@ApiOperation(value = "检测依据列表")
@GetMapping("/getList")
public BaseResponse getList() {
try {
return methodService.getList();
} catch (Exception e) {
log.debug("检测标准列表{}", e);
log.debug("检测依据列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "新增检测标准")
@ApiOperation(value = "新增检测依据")
@PostMapping("/create")
@Transactional
public BaseResponse create(@RequestBody MethodQuery query){
try {
return methodService.create(query);
}catch (Exception e){
log.debug("新增检测标准{}",e);
log.debug("新增检测依据{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "更新检测标准")
@ApiOperation(value = "更新检测依据")
@PostMapping("/update")
@Transactional
public BaseResponse update(@RequestBody MethodQuery query){
try {
return methodService.update(query);
}catch (Exception e){
log.debug("更新检测标准{}",e);
log.debug("更新检测依据{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "删除检测标准")
@ApiOperation(value = "删除检测依据")
@PostMapping("/delete/{id}")
public BaseResponse delete(@PathVariable Integer id){
try {
return methodService.delete(id);
}catch (Exception e){
log.debug("删除检测标准{}",e);
log.debug("删除检测依据{}",e);
}
return BaseResponse.errorMsg("失败!");
}
......
......@@ -125,6 +125,20 @@ public class ProjectController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "根据项目名称判断是否存在")
@GetMapping("/getByName")
public BaseResponse getByName(String name){
try {
return projectService.getByName(name);
}catch (Exception e){
log.debug("根据项目名称判断是否存在{}",e);
}
return BaseResponse.errorMsg("失败!");
}
......
......@@ -6,6 +6,7 @@ import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.SampleManageQuery;
import cn.wise.sc.cement.business.model.query.StandardQuery;
import cn.wise.sc.cement.business.service.ISampleService;
import cn.wise.sc.cement.business.service.ISysDictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -32,6 +33,8 @@ public class SampleController {
@Autowired
private ISampleService sampleService;
@Autowired
private ISysDictionaryService dictionaryService;
@ApiOperation(value = "样品分页列表")
@ApiImplicitParams(value = {
......@@ -81,8 +84,16 @@ public class SampleController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "获取样品状态列表")
@GetMapping("/getSampleFormList")
public BaseResponse getSampleFormList(){
try {
return dictionaryService.getContent("样品状态");
}catch (Exception e){
log.debug("获取样品状态列表{}",e);
}
return BaseResponse.errorMsg("失败!");
}
......
......@@ -43,7 +43,7 @@ public class TeamController {
@ApiOperation(value = "检测项分页列表")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "status", value = "状态0:禁用 1:启用", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "groupName", value = "所在分组名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "groupName", value = "检测组名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "name", value = "检测项目名称", paramType = "query", dataType = "String")
})
@GetMapping("/getPage")
......@@ -56,43 +56,6 @@ public class TeamController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation("检测项导出")
@PostMapping("/export")
public void export(Integer status, Integer gourpId, String name, String fileName, HttpServletResponse response) {
try {
teamService.export(status, gourpId, name, fileName, response);
} catch (Exception e) {
log.debug("检测项导出{}", e);
}
}
@ApiOperation(value = "检测项详情")
@GetMapping("/{id}")
public BaseResponse getById(@PathVariable Integer id){
try {
Team e = teamService.getById(id);
if(e == null){
return BaseResponse.errorMsg("信息错误!");
}
return BaseResponse.okData(e);
}catch (Exception e){
log.debug("检测项详情{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测项列表")
@GetMapping("/getList")
public BaseResponse getList() {
try {
return teamService.getList();
} catch (Exception e) {
log.debug("检测项列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "新增检测项")
@PostMapping("/create")
public BaseResponse create(@RequestBody TeamQuery query){
......@@ -126,5 +89,38 @@ public class TeamController {
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测项详情")
@GetMapping("/{id}")
public BaseResponse getDetail(@PathVariable Integer id){
try {
return teamService.getDetail(id);
}catch (Exception e){
log.debug("检测项详情{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测项列表")
@GetMapping("/getList")
public BaseResponse getList() {
try {
return teamService.getList();
} catch (Exception e) {
log.debug("检测项列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation("检测项导出")
@PostMapping("/export")
public void export(Integer status, Integer gourpId, String name, String fileName, HttpServletResponse response) {
try {
teamService.export(status, gourpId, name, fileName, response);
} catch (Exception e) {
log.debug("检测项导出{}", e);
}
}
}
......@@ -25,7 +25,7 @@ import java.util.List;
* @author ztw
* @since 2020-09-10
*/
@Api(tags="配置管理-检测项组管理")
@Api(tags="配置管理-检测组配置")
@RestController
@RequestMapping("/business/team-group")
public class TeamGroupController {
......@@ -35,43 +35,43 @@ public class TeamGroupController {
@Autowired
private ITeamGroupService teamGroupService;
@ApiOperation(value = "检测组分页列表")
@ApiOperation(value = "检测组分页列表")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "name", value = "检测组名称", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "name", value = "检测组名称", paramType = "query", dataType = "String")
})
@GetMapping("/getPage")
public BaseResponse getPage(PageQuery pageQuery, String name) {
try {
return teamGroupService.getPage(pageQuery, name);
} catch (Exception e) {
log.debug("检测组分页列表{}", e);
log.debug("检测组分页列表{}", e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "新增检测组")
@ApiOperation(value = "新增检测组")
@PostMapping("/create")
public BaseResponse create(@RequestBody TeamGroup query) {
try {
return teamGroupService.create(query);
}catch (Exception e) {
log.debug("新增检测组{}",e);
log.debug("新增检测组{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "修改检测组")
@ApiOperation(value = "修改检测组")
@PostMapping("/update")
public BaseResponse update(@RequestBody TeamGroup query) {
try {
return teamGroupService.update(query);
}catch (Exception e) {
log.debug("修改检测组{}",e);
log.debug("修改检测组{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测组详情")
@ApiOperation(value = "检测组详情")
@GetMapping("/{id}")
public BaseResponse getById(@PathVariable Integer id){
try {
......@@ -81,31 +81,31 @@ public class TeamGroupController {
}
return BaseResponse.okData(group);
}catch (Exception e){
log.debug("检测组详情{}",e);
log.debug("检测组详情{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "检测组列表")
@ApiOperation(value = "检测组列表")
@GetMapping("/getList")
public BaseResponse getById(){
try {
List<TeamGroup> list = teamGroupService.list();
return BaseResponse.okData(list);
}catch (Exception e){
log.debug("检测组列表{}",e);
log.debug("检测组列表{}",e);
}
return BaseResponse.errorMsg("失败!");
}
@ApiOperation(value = "删除检测组")
@ApiOperation(value = "删除检测组")
@PostMapping("/delete/{id}")
public BaseResponse delete(@PathVariable Integer id) {
try {
teamGroupService.removeById(id);
return BaseResponse.okData("删除成功");
} catch (Exception e) {
log.debug("删除检测组{}", e);
log.debug("删除检测组{}", e);
}
return BaseResponse.errorMsg("失败!");
}
......
......@@ -60,20 +60,20 @@ public class Entrust implements Serializable {
@ApiModelProperty("拟定完成日期")
private LocalDate finishDate;
@ApiModelProperty("受理人id")
@ApiModelProperty("申请委托人id")
private Integer userId;
@ApiModelProperty("样品数量")
private Integer sampleNum;
@ApiModelProperty("(1加急,0不加急)")
private Integer isUrgent;
@ApiModelProperty("剩余样品处理方法(0,取回,1由本所统一处置)")
private Integer handleMethod;
@ApiModelProperty("状态(0未审批,1已通过,2未通过,3样品处理,4派发)")
@ApiModelProperty("状态(0未评审,1已通过,2未通过,3样品处理中,4样品处理完成," +
"5样品检测中,6样品检测完成,7校核中,8校核完成)")
private Integer status;
@ApiModelProperty("项目类型(常规项目,科研项目,质量控制项目)")
......
......@@ -38,7 +38,7 @@ public class Method implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("检测标准名")
@ApiModelProperty("检测依据名")
private String name;
@ApiModelProperty("标准号")
......
......@@ -64,6 +64,9 @@ public class Sample implements Serializable {
@ApiModelProperty("本所编号")
private String cementCode;
@ApiModelProperty("收费标准")
private BigDecimal charge;
@ApiModelProperty("产值")
private BigDecimal outputValue;
......
......@@ -38,7 +38,7 @@ public class SampleHandle implements Serializable {
@ApiModelProperty("处理人id")
private Integer userId;
@ApiModelProperty("处理项")
@ApiModelProperty("样品处理项id 例子:1、2、3")
private String content;
@ApiModelProperty("要求完成日期(计划完成日期)")
......
......@@ -56,6 +56,9 @@ public class SampleTmp implements Serializable {
@ApiModelProperty("委托表id")
private Integer entrustId;
@ApiModelProperty("收费标准")
private BigDecimal charge;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
......
package cn.wise.sc.cement.business.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author ztw
* @since 2020-09-12
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysDictionary implements Serializable {
private static final long serialVersionUID=1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("名称")
private String name;
/*[{"name": "块状"}, {"name": "粉状"}, {"name": "颗粒"}, {"name": "液态"}, {"name": "气态"},
{"name": "等离子态"}, {"name": "超临界态"}, {"name": "超固态"}, {"name": "中子态"}]*/
@ApiModelProperty("内容 json串")
private String content;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("备注")
private String remark;
}
......@@ -39,14 +39,11 @@ public class Team extends BaseEntity implements Serializable {
@ApiModelProperty("检测项目")
private String name;
@ApiModelProperty("检测项组id")
@ApiModelProperty("检测组表id")
private Integer groupId;
@ApiModelProperty("检测项组名称")
private String groupName;
@ApiModelProperty("检测依据")
private String basis;
@ApiModelProperty("检测依据表id")
private Integer methodId;
@ApiModelProperty("收费标准")
private BigDecimal charge;
......
......@@ -28,7 +28,7 @@ public class TeamGroup implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("检测组名称")
@ApiModelProperty("检测组名称")
private String name;
@ApiModelProperty("创建时间")
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
......@@ -24,4 +25,7 @@ public interface EntrustMapper extends BaseMapper<Entrust> {
EntrustVo getDetail(Integer id);
@Select("select count(*) from entrust where day(create_time) = day(now())")
Integer counts();
}
......@@ -22,6 +22,10 @@ public interface ProjectMapper extends BaseMapper<Project> {
IPage<ProjectVo> getPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<ProjectVo> getList();
ProjectVo getByName(String name);
List<Map<String, Object>> exportList(@Param("params") Map<String, Object> params);
}
......@@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import javax.websocket.server.ServerEndpoint;
/**
* <p>
......@@ -20,6 +23,9 @@ public interface SysApprovalMapper extends BaseMapper<SysApproval> {
IPage<ApprovalVo> getPage(@Param("page") Page page);
@Select("select user_id from sys_approval where name=#{name} and status=1 ")
Integer getApprovalId(String name);
}
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.SysDictionary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author ztw
* @since 2020-09-12
*/
public interface SysDictionaryMapper extends BaseMapper<SysDictionary> {
}
package cn.wise.sc.cement.business.mapper;
import cn.wise.sc.cement.business.entity.Team;
import cn.wise.sc.cement.business.model.vo.TeamListVo;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -22,6 +23,11 @@ public interface TeamMapper extends BaseMapper<Team> {
IPage<TeamVo> getPage(@Param("page") Page page, @Param("params") Map<String, Object> params);
List<TeamListVo> getList();
TeamVo getDetail(Integer id);
List<Map<String, Object>> exportList(@Param("params") Map<String, Object> params);
}
......@@ -14,12 +14,15 @@
<if test="params.status != null">
and e.status = #{params.status}
</if>
<if test="params.clientId != null and params.clientId != ''">
<if test="params.clientId != null">
and e.client_id = #{params.clientId}
</if>
<if test="params.projectName != null and params.projectName != ''">
and p.name like concat('%', #{params.projectName}, '%')
</if>
<if test="params.userId != null">
and e.user_id = #{params.userId}
</if>
</where>
</sql>
......@@ -27,9 +30,16 @@
select e.*, p.name as projectName, c.name as clientName, su.name as userName,
(
CASE e.status
WHEN 0 THEN '未审批'
WHEN 0 THEN '未评审'
WHEN 1 THEN '已通过'
ELSE '未通过'
WHEN 2 THEN '未通过'
WHEN 3 THEN '样品处理中'
WHEN 4 THEN '样品处理完成'
WHEN 5 THEN '样品检测中'
WHEN 6 THEN '样品检测完成'
WHEN 7 THEN '校核中'
WHEN 8 THEN '校核完成'
ELSE ''
END
) as statusValue
from entrust e
......@@ -37,7 +47,7 @@
left join client c on c.id = e.client_id
left join sys_user su on su.id = e.user_id
<include refid="where" />
order by e.create_time desc
order by e.update_time desc
</select>
<select id="getDetail" resultType="cn.wise.sc.cement.business.model.vo.EntrustVo">
......
......@@ -15,7 +15,7 @@
<select id="exportList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
t.name as 检测标准名,
t.name as 检测依据名,
t.standard as 标准号,
t.number as 编号,
t.do_date as 实施日期,
......
......@@ -23,6 +23,25 @@
order by t.id desc
</select>
<select id="getList" resultType="cn.wise.sc.cement.business.model.vo.ProjectVo">
select t.*,
cl.id as clientId, cl.name clientName
FROM project t
left join client cl on cl.id = t.client_id
where t.status = 1
order by t.id desc
</select>
<select id="getByName" resultType="cn.wise.sc.cement.business.model.vo.ProjectVo">
select t.*,
cl.id as clientId, cl.name clientName
FROM project t
left join client cl on cl.id = t.client_id
where t.status = 1 and t.name=#{name}
</select>
<select id="exportList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wise.sc.cement.business.mapper.SysDictionaryMapper">
</mapper>
......@@ -7,7 +7,7 @@
and t.status = #{params.status}
</if>
<if test="params.groupName != null and params.groupName != ''">
and t.group_name = #{params.groupName}
and tg.group_name = #{params.groupName}
</if>
<if test="params.name != null and params.name != ''">
and t.name like concat('%', #{params.name}, '%')
......@@ -16,25 +16,50 @@
</sql>
<select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.TeamVo">
SELECT t.*
SELECT t.*, tg.name as groupName,
m.name as methodName, m.standard as standard, m.number as number
FROM team t
left join team_group tg on tg.id = t.group_id
left join method m on m.id = t.method_id
<include refid="where" />
ORDER BY t.id DESC
</select>
<select id="getList" resultType="cn.wise.sc.cement.business.model.vo.TeamListVo">
SELECT t.id as id, t.name as name, t.method_id as methodId,
m.name as methodName, m.number as number
FROM team t
left join method m on m.id = t.method_id
where t.status=1
ORDER BY t.id ASC
</select>
<select id="getDetail" resultType="cn.wise.sc.cement.business.model.vo.TeamVo">
SELECT t.*, tg.name as groupName,
m.name as methodName, m.standard as standard, m.number as number
FROM team t
left join team_group tg on tg.id = t.group_id
left join method m on m.id = t.method_id
where t.id = ${id}
</select>
<select id="exportList" resultType="java.util.HashMap">
SELECT
(@i:=@i+1) as 序号,
t.name as 检测项目,
t.group_name as 分组,
t.basis as 检测依据,
tg.name as 检测组,
m.standard as 检测依据标准号,
t.charge as 收费标准,
t.pro_charge as 建议产值,
t.qualifications as 资质范围
FROM team t
left join team_group tg on tg.id = t.group_id
left join method m on m.id = t.method_id
,(select @i:=0)t
<include refid="where" />
ORDER BY t.id DESC
</select>
......
......@@ -15,7 +15,7 @@ import java.time.LocalDate;
public class MethodQuery {
private Integer id;
@ApiModelProperty("检测标准名")
@ApiModelProperty("检测依据名")
private String name;
@ApiModelProperty("标准号")
......
......@@ -23,7 +23,7 @@ public class SampleHandleQuery {
@ApiModelProperty("处理人id")
private Integer userId;
@ApiModelProperty("处理项")
@ApiModelProperty("样品处理项id 例子:1、2、3")
private String content;
@ApiModelProperty("要求完成日期(计划完成日期)")
......
......@@ -45,6 +45,9 @@ public class SampleQuery {
@ApiModelProperty("本所编号")
private String cementCode;
@ApiModelProperty("收费标准")
private BigDecimal charge;
@ApiModelProperty("产值")
private BigDecimal outputValue;
......
......@@ -40,7 +40,4 @@ public class SampleTmpQuery {
@ApiModelProperty("(检测依据编号) 例子:01、23、15")
private String methodNumbers;
}
......@@ -22,11 +22,8 @@ public class TeamQuery {
@ApiModelProperty("检测项组id")
private Integer groupId;
@ApiModelProperty("检测项组名称")
private String groupName;
@ApiModelProperty("检测依据")
private String basis;
@ApiModelProperty("检测依据表id")
private Integer methodId;
@ApiModelProperty("收费标准")
private BigDecimal charge;
......
......@@ -20,6 +20,9 @@ public class EntrustVo {
@ApiModelProperty("委托表id")
private Integer id;
@ApiModelProperty("委托编号")
private String entrustCode;
@ApiModelProperty("项目id")
private Integer projectId;
......@@ -62,8 +65,8 @@ public class EntrustVo {
@ApiModelProperty("样品数量")
private Integer sampleNum;
@ApiModelProperty("状态(0未审批,1已通过,2未通过,3样品处理,4派发)")
@ApiModelProperty("状态(0未评审,1已通过,2未通过,3样品处理中,4样品处理完成," +
"5样品检测中,6样品检测完成,7校核中,8校核完成)")
private Integer status;
@ApiModelProperty("状态")
......@@ -102,6 +105,8 @@ public class EntrustVo {
@ApiModelProperty("检测项 只显示第一个样品的")
private String checkTeam;
@ApiModelProperty("检测依据编号 只显示第一个样品的")
private String checkMethodNumber;
......
......@@ -25,6 +25,9 @@ public class ProjectVo {
@ApiModelProperty("项目编号:客户自己填的")
private String code;
@ApiModelProperty("委托单位id")
private Integer clientId;
@ApiModelProperty("委托单位名")
private String clientName;
......
......@@ -18,7 +18,6 @@ public class SampleTmpVo {
@ApiModelProperty("样品临时表id")
private Integer id;
@ApiModelProperty("来样编号(样品编号)")
private String sampleCode;
......@@ -46,5 +45,8 @@ public class SampleTmpVo {
@ApiModelProperty("委托表id")
private Integer entrustId;
@ApiModelProperty("收费标准")
private BigDecimal charge;
}
package cn.wise.sc.cement.business.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @description:
* @author: ztw
* @create: 2020-08-07 15:09
**/
@Data
@ApiModel("检测项列表Vo")
public class TeamListVo {
@ApiModelProperty("检测项表id")
private Integer id;
@ApiModelProperty("检测项目")
private String name;
@ApiModelProperty("检测依据表id")
private Integer methodId;
@ApiModelProperty("检测依据名称")
private String methodName;
@ApiModelProperty("检测依据编号")
private String number;
}
......@@ -23,14 +23,23 @@ public class TeamVo{
@ApiModelProperty("检测项目")
private String name;
@ApiModelProperty("检测组id")
@ApiModelProperty("检测组id")
private Integer groupId;
@ApiModelProperty("检测组名称")
@ApiModelProperty("检测组名称")
private String groupName;
@ApiModelProperty("检测依据")
private String basis;
@ApiModelProperty("检测依据表id")
private Integer methodId;
@ApiModelProperty("检测依据名称")
private String methodName;
@ApiModelProperty("检测依据标准号")
private String standard;
@ApiModelProperty("检测依据编号")
private String number;
@ApiModelProperty("收费标准")
private BigDecimal charge;
......
......@@ -23,6 +23,8 @@ public interface IEntrustService extends IService<Entrust> {
BaseResponse<IPage<EntrustVo>> getPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
Integer clientId, String projectName);
BaseResponse<String> setTopping(Integer id);
BaseResponse<Entrust> create(EntrustQuery query);
BaseResponse<EntrustVo> getDtail(Integer id);
......
......@@ -37,7 +37,7 @@ public interface IProjectService extends IService<Project> {
*
* @return List
*/
BaseResponse<List<Project>> getList();
BaseResponse<List<ProjectVo>> getList();
/**
* 新增项目
......@@ -64,6 +64,8 @@ public interface IProjectService extends IService<Project> {
*/
BaseResponse<String> status(Integer status, Integer id);
BaseResponse<ProjectVo> getByName(String name);
/**
* 项目导出
* @param code
......
package cn.wise.sc.cement.business.service;
import cn.wise.sc.cement.business.entity.SysDictionary;
import cn.wise.sc.cement.business.model.BaseResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author ztw
* @since 2020-09-12
*/
public interface ISysDictionaryService extends IService<SysDictionary> {
BaseResponse<JSONArray> getContent(String name);
}
......@@ -4,6 +4,7 @@ import cn.wise.sc.cement.business.entity.Team;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.TeamQuery;
import cn.wise.sc.cement.business.model.vo.TeamListVo;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -21,51 +22,18 @@ import java.util.List;
*/
public interface ITeamService extends IService<Team> {
/**
* 获取分页
* @param pageQuery
* @param status
* @param name
* @return
*/
BaseResponse<IPage<TeamVo>> getPage(PageQuery pageQuery, Integer status, String groupName, String name);
/**
* 获取所有启动的信息
* @return
*/
BaseResponse<List<TeamVo>> getList();
/**
* 新增
* @param query
* @return
*/
BaseResponse<Team> create(TeamQuery query);
/**
* 编辑
* @param query
* @return
*/
BaseResponse<Team> update(TeamQuery query);
/**
* 启用禁用
* @param status
* @param id
* @return
*/
BaseResponse<String> status(Integer status, Integer id);
/**
* 检测项导出
* @param status
* @param gourpId
* @param name
* @param fileName
* @param response
*/
BaseResponse<TeamVo> getDetail(Integer id);
BaseResponse<List<TeamListVo>> getList();
void export(Integer status, Integer gourpId, String name, String fileName, HttpServletResponse response);
......
......@@ -79,6 +79,18 @@ public class CommonServiceImpl {
return counts;
}
/**
* Integer补0 转String
* @param counts
* @return
*/
public String getCementCode(Integer counts){
String tailNo = counts<10?("000"+counts):
counts<100?("00"+counts):
counts<1000?("000"+counts):
String.valueOf(counts);
return tailNo;
}
/**
......
......@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import sun.print.BackgroundServiceLookup;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
......@@ -76,6 +77,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
RedisUtil redisUtil;
@Resource
private SampleMapper sampleMapper;
@Resource
private SysApprovalMapper sysApprovalMapper;
@Resource
private MethodMapper methodMapper;
/**
* 委托分页
......@@ -90,12 +95,23 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
@Override
public BaseResponse<IPage<EntrustVo>> getPage(PageQuery pageQuery, String startDate, String endDate, Integer status,
Integer clientId, String projectName){
LoginUser loginUser = userService.getLoginUser();
if(loginUser == null){
return BaseResponse.errorMsg("请登录账号");
}
Map<String, Object> params = new HashMap<>();
params.put("startDate", startDate);
params.put("endDate", endDate);
params.put("status", status);
params.put("clientId", clientId);
params.put("projectName", projectName);
Integer approvalId = sysApprovalMapper.getApprovalId("委托评审");
if(approvalId == null){
return BaseResponse.errorMsg("委托评审信息错误");
}
if(loginUser.getId() != approvalId){
params.put("userId", loginUser.getId());
}
Page<EntrustVo> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
IPage<EntrustVo> pages = entrustMapper.getPage(page, params);
List<EntrustVo> list = pages.getRecords();
......@@ -114,12 +130,12 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
for(String teamId : teamIdS){
Team team = teamMapper.selectById(Integer.valueOf(teamId));
if(team != null){
team.getName();
checkTeam = checkTeam.equals("")?team.getName():(checkTeam+"、"+team.getName());
}
}
}
entrustVo.setCheckTeam(checkTeam);
entrustVo.setCheckMethodNumber(sampleTmp.getMethodNumbers());
}
}
}
......@@ -127,6 +143,29 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
return BaseResponse.okData(pages);
}
/**
* 置顶
* @param id 委托表id
* @return
*/
public BaseResponse<String> setTopping(Integer id){
if(id == null){
return BaseResponse.errorMsg("参数错误");
}
Entrust entrust = entrustMapper.selectById(id);
if(entrust == null){
return BaseResponse.errorMsg("数据错误");
}
entrust.setUpdateTime(LocalDateTime.now());
entrustMapper.updateById(entrust);
return BaseResponse.okMsg("置顶成功");
}
/**
* 新增委托
* @param query
......@@ -135,6 +174,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
@Transactional
@Override
public BaseResponse<Entrust> create(EntrustQuery query){
LoginUser loginUser = userService.getLoginUser();
if(loginUser == null){
return BaseResponse.errorMsg("请登录账号");
}
if(query.getClientId() == null){
return BaseResponse.errorMsg("请选择委托单位");
}
......@@ -149,16 +192,15 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
Entrust entrust = new Entrust();
BeanUtils.copyProperties(query,entrust);
//生成委托编号
QueryWrapper<Entrust> entrustQueryWrapper = new QueryWrapper<>();
entrustQueryWrapper.eq("create_time", LocalDateTime.now());
String entrustCode = commonService.createNo("WT", this.count(entrustQueryWrapper));
String entrustCode = commonService.createNo("WT", entrustMapper.counts());
entrust.setEntrustCode(entrustCode)
.setUserId(userService.getLoginUser()!=null?userService.getLoginUser().getId():1)
.setUserId(loginUser.getId())
.setStatus(0)
.setIsDelete(1)
.setIsHandle(0)
.setIsDistribution(0)
.setCreateTime(LocalDateTime.now())
.setUpdateTime(entrust.getCreateTime())
.setSampleNum(query.getSampleTmpList().size());
entrustMapper.insert(entrust);
if(query.getSampleTmpList() != null && query.getSampleTmpList().size()>0){
......@@ -166,9 +208,22 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
for(SampleTmpQuery sampleTmpQuery : query.getSampleTmpList()){
SampleTmp sampleTmp = new SampleTmp();
BeanUtils.copyProperties(sampleTmpQuery, sampleTmp);
sampleTmp.setEntrustId(entrust.getId()).setCreateTime(LocalDateTime.now());
String teamIds = sampleTmpQuery.getTeamIds();
BigDecimal charge = new BigDecimal("0.00");
System.out.println("charge==========================="+charge);
if(teamIds != null){
String[] teamIdS = teamIds.split("、");
for(String teamId : teamIdS){
Team team = teamMapper.selectById(Integer.valueOf(teamId));
if(team != null){
charge = charge.compareTo(BigDecimal.ZERO)==0?team.getCharge():(charge.add(team.getCharge()));
}
}
}
sampleTmp.setEntrustId(entrust.getId())
.setCharge(charge)
.setCreateTime(LocalDateTime.now());
sampleTmpList.add(sampleTmp);
//sampleTmpMapper.insert(sampleTmp);
}
sampleTmpService.saveBatch(sampleTmpList);
}
......@@ -332,7 +387,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
}
integerMaxCode = cementCodeInteger>integerMaxCode?cementCodeInteger:integerMaxCode;
String yearStr = commonService.getIntegerYear(maxCementCode);
maxCementCode= yearStr +"-"+ integerMaxCode;
maxCementCode= yearStr +"-"+ commonService.getCementCode(integerMaxCode);
Sample sample = new Sample();
BeanUtils.copyProperties(sampleQuery, sample);
sample.setId(null)
......@@ -361,10 +416,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//最大的平行样编号放入redis
redisUtil.setString("maxCementCode", maxCementCode);
}
entrust.setStatus(1).setProjectType(query.getProjectType()).setUpdateTime(LocalDateTime.now());
entrust.setStatus(1).setProjectType(query.getProjectType());
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“通过”", null);
}else if (query.getIsAgree() == 2){ //驳回
entrust.setStatus(2).setUpdateTime(LocalDateTime.now());
entrust.setStatus(2);
logsService.saveLog(SysLogs.ObjType.ENTRUST_LOG, entrust.getId(), "修改评审状态为“驳回”", null);
}else{
return BaseResponse.errorMsg("请选择正确按钮");
......
......@@ -71,7 +71,7 @@ public class MethodServiceImpl extends ServiceImpl<MethodMapper, Method> impleme
qw.eq("name", query.getName());
int count = methodMapper.selectCount(qw);
if(count>0){
return BaseResponse.errorMsg("检测标准名称已存在!");
return BaseResponse.errorMsg("检测依据名称已存在!");
}
Method crate = new Method();
BeanUtils.copyProperties(query, crate);
......@@ -101,8 +101,8 @@ public class MethodServiceImpl extends ServiceImpl<MethodMapper, Method> impleme
Map<String, Object> map = list.get(0);
String[] headers = new String[map.size()];
headers[0] = "序号";
headers[1] = "检测标准名";
headers[2] = "标准号";
headers[1] = "检测依据名";
headers[2] = "依据号";
headers[3] = "编号";
headers[4] = "实施日期";
headers[5] = "更新日期";
......@@ -119,7 +119,7 @@ public class MethodServiceImpl extends ServiceImpl<MethodMapper, Method> impleme
datas.add(objects);
}
ExcelUtil.excelExport(
fileName == null || fileName.trim().length() <= 0 ? "检测标准": fileName, headers,
fileName == null || fileName.trim().length() <= 0 ? "检测依据": fileName, headers,
datas, response);
}
}
......@@ -128,7 +128,7 @@ public class MethodServiceImpl extends ServiceImpl<MethodMapper, Method> impleme
public BaseResponse delete(Integer id) {
Method method = methodMapper.selectById(id);
if(method == null){
return BaseResponse.errorMsg("检测标准不存在");
return BaseResponse.errorMsg("检测依据不存在");
}
methodMapper.deleteById(id);
return BaseResponse.okData("删除成功");
......
......@@ -14,6 +14,7 @@ import cn.wise.sc.cement.business.model.vo.ProjectVo;
import cn.wise.sc.cement.business.service.IClientService;
import cn.wise.sc.cement.business.service.IProjectService;
import cn.wise.sc.cement.business.util.ExcelUtil;
import cn.wise.sc.cement.business.wrapper.page.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
......@@ -64,10 +65,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
}
@Override
public BaseResponse<List<Project>> getList() {
QueryWrapper<Project> qw = new QueryWrapper<>();
qw.eq("status", 1);
List<Project> list = this.list(qw);
public BaseResponse<List<ProjectVo>> getList() {
List<ProjectVo> list = projectMapper.getList();
return BaseResponse.okData(list);
}
......@@ -128,6 +127,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
return BaseResponse.okData(result);
}
/**
* 根据项目名称返回项目信息
* @param name
* @return
*/
public BaseResponse<ProjectVo> getByName(String name){
ProjectVo projectVo = projectMapper.getByName(name);
if(projectVo == null){
return BaseResponse.errorMsg("系统暂无本项目,需要创建");
}
return BaseResponse.okData(projectVo);
}
@Override
public void export(String code, Integer clientId, String name, String fileName, HttpServletResponse response){
Map<String, Object> params = new HashMap<>();
......
package cn.wise.sc.cement.business.service.impl;
import cn.wise.sc.cement.business.entity.SysDictionary;
import cn.wise.sc.cement.business.mapper.SysDictionaryMapper;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.service.ISysDictionaryService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mysql.cj.xdevapi.JsonArray;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* <p>
* 服务实现类
* </p>
*
* @author ztw
* @since 2020-09-12
*/
@Service
public class SysDictionaryServiceImpl extends ServiceImpl<SysDictionaryMapper, SysDictionary> implements ISysDictionaryService {
@Resource
private SysDictionaryMapper dictionaryMapper;
@Override
public BaseResponse<JSONArray> getContent(String name){
QueryWrapper<SysDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name", name);
SysDictionary dictionary = dictionaryMapper.selectOne(queryWrapper);
if(dictionary == null){
return BaseResponse.errorMsg("信息错误");
}
String coneten = dictionary.getContent();
JSONArray jsonArray= JSONArray.parseArray(coneten);
return BaseResponse.okData(jsonArray);
}
}
......@@ -8,6 +8,7 @@ import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.PageQuery;
import cn.wise.sc.cement.business.model.query.TeamQuery;
import cn.wise.sc.cement.business.model.vo.ClientVo;
import cn.wise.sc.cement.business.model.vo.TeamListVo;
import cn.wise.sc.cement.business.model.vo.TeamVo;
import cn.wise.sc.cement.business.service.ITeamService;
import cn.wise.sc.cement.business.util.ExcelUtil;
......@@ -64,40 +65,58 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements IT
return BaseResponse.okData(pages);
}
@Override
public BaseResponse<List<TeamVo>> getList() {
QueryWrapper<Team> qw = new QueryWrapper<>();
qw.eq("status", 1);
List<Team> list = this.list(qw);
List<TeamVo> rts = new ArrayList<>(list.size());
list.forEach(arg -> {
TeamVo teamVo = new TeamVo();
teamVo.setId(arg.getId());
teamVo.setName(arg.getName());
rts.add(teamVo);
});
return BaseResponse.okData(rts);
}
/**
* 新增检测项
* @param query
* @return
*/
@Override
@Transactional
public BaseResponse<Team> create(TeamQuery query) {
Team create = new Team();
if(query.getGroupId() == null){
return BaseResponse.errorMsg("请选择检测组");
}
if(query.getMethodId() == null){
return BaseResponse.errorMsg("请选择检依据");
}
BeanUtils.copyProperties(query, create);
create.setStatus(1).setCreateTime(LocalDateTime.now());
teamMapper.insert(create);
return BaseResponse.okData(create);
}
/**
* 修改检测项
* @param query
* @return
*/
@Override
@Transactional
public BaseResponse<Team> update(TeamQuery query) {
Team update = teamMapper.selectById(query.getId());
if(update == null){
return BaseResponse.errorMsg("信息错误");
}
if(query.getGroupId() == null){
return BaseResponse.errorMsg("请选择检测组");
}
if(query.getMethodId() == null){
return BaseResponse.errorMsg("请选择检依据");
}
update.setGroupId(query.getGroupId())
.setMethodId(query.getMethodId())
.setName(query.getName());
teamMapper.updateById(update);
return BaseResponse.okData(update);
}
/**
* 启用禁用
* @param status
* @param id
* @return
*/
@Override
@Transactional
public BaseResponse<String> status(Integer status, Integer id) {
......@@ -119,6 +138,29 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements IT
return BaseResponse.okData(result);
}
/**
* 检测项详情
* @param id
* @return
*/
public BaseResponse<TeamVo> getDetail(Integer id) {
TeamVo teamVo = teamMapper.getDetail(id);
if(teamVo == null){
return BaseResponse.errorMsg("信息错误!");
}
return BaseResponse.okData(teamVo);
}
/**
* 检测项列表
* @return
*/
@Override
public BaseResponse<List<TeamListVo>> getList() {
List<TeamListVo> list = teamMapper.getList();
return BaseResponse.okData(list);
}
@Override
public void export(Integer status, Integer gourpId, String name, String fileName, HttpServletResponse response) {
Map<String, Object> params = new HashMap<>();
......@@ -132,8 +174,8 @@ public class TeamServiceImpl extends ServiceImpl<TeamMapper, Team> implements IT
String[] headers = new String[map.size()];
headers[0] = "序号";
headers[1] = "检测项目";
headers[2] = "组";
headers[3] = "检测依据";
headers[2] = "检测组";
headers[3] = "检测依据标准号";
headers[4] = "收费标准";
headers[5] = "建议产值";
headers[6] = "资质范围";
......
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