From b4332231c22b9c362e14def25525d8c72735bc8c Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期四, 07 九月 2023 15:23:08 +0800
Subject: [PATCH] MOM系统-9-07
---
inspect-server/src/main/resources/mapper/OpinionMapper.xml | 9 ++
system-run/src/main/resources/application-dev.yml | 4
inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml | 80 +++++++++++---------------
inspect-server/src/main/java/com/yuanchu/mom/pojo/InspectUnaccepted.java | 2
inspect-server/src/main/java/com/yuanchu/mom/pojo/dto/UpdateInspectUnacceptedDto.java | 15 +++++
inspect-server/src/main/java/com/yuanchu/mom/pojo/Opinion.java | 8 +-
inspect-server/src/main/java/com/yuanchu/mom/controller/InspectUnacceptedController.java | 16 +++--
inspect-server/src/main/java/com/yuanchu/mom/mapper/OpinionMapper.java | 3
inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java | 7 +
inspect-server/src/main/java/com/yuanchu/mom/service/InspectUnacceptedService.java | 2
inspect-server/src/main/java/com/yuanchu/mom/service/OpinionService.java | 3
11 files changed, 83 insertions(+), 66 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InspectUnacceptedController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InspectUnacceptedController.java
index dd389f2..ccf1740 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InspectUnacceptedController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InspectUnacceptedController.java
@@ -8,9 +8,7 @@
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.utils.Jwt;
import com.yuanchu.mom.utils.MyUtil;
-import com.yuanchu.mom.utils.RedisUtil;
import com.yuanchu.mom.vo.Result;
-import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -117,10 +115,12 @@
@ApiOperation(value = "缂栬緫鎰忚-->纭畾鎸夐挳", tags = "QMS绠$悊-->涓嶅悎鏍煎搧澶勭疆")
@PostMapping("/addOpinion")
public Result<?> updateOpinion(@RequestHeader("token") String token, @Validated @RequestBody List<Opinion> opinion) throws Exception {
+ MyUtil.PrintLog(opinion.toString());
+
Map<String, String> data = JackSonUtil.unmarshal(jwt.readJWT(token).get("data"), Map.class);
String id = data.get("id").replaceAll("\"", "");
opinionService.updateOpinion(id, opinion);
- return Result.success();
+ return Result.success("娣诲姞鎴愬姛锛�");
}
@ApiOperation(value = "鏌ョ湅缂栬緫鎰忚", tags = "QMS绠$悊-->涓嶅悎鏍煎搧澶勭疆")
@@ -139,15 +139,19 @@
})
@GetMapping("/descriptionUpdate")
public Result<?> descriptionUpdate(Integer rawUnacceptedId, String tell) {
- return Result.success(inspectUnacceptedService.descriptionUpdate(rawUnacceptedId, tell));
+ Integer isUpdateSuccess = inspectUnacceptedService.descriptionUpdate(rawUnacceptedId, tell);
+ if (isUpdateSuccess == 1) {
+ return Result.success("鏇存柊鎴愬姛");
+ }
+ return Result.fail("鏇存柊澶辫触");
}
@ApiOperation(value = "鐐瑰嚮缂栬緫鎰忚瑙﹀彂鏌ヨ", tags = "QMS绠$悊-->涓嶅悎鏍煎搧澶勭疆")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "rawUnacceptedId",value = "涓嶅悎鏍煎搧澶勭疆Id",dataTypeClass = Integer.class,required = true)
})
- @PostMapping("/clickEditing")
- public Result<?> clickEditingTriggerQuery(Integer rawUnacceptedId) {
+ @GetMapping("/clickEditing")
+ public Result<?> clickEditingTriggerQuery(@RequestParam("rawUnacceptedId") Integer rawUnacceptedId) {
return Result.success(opinionService.clickEditingTriggerQuery(rawUnacceptedId));
}
}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/OpinionMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/OpinionMapper.java
index 4da43f7..2ff3d8b 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/OpinionMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/OpinionMapper.java
@@ -3,6 +3,7 @@
import com.yuanchu.mom.mybatis_config.MyBaseMapper;
import com.yuanchu.mom.pojo.Opinion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto;
import java.util.List;
import java.util.Map;
@@ -17,7 +18,7 @@
*/
public interface OpinionMapper extends MyBaseMapper<Opinion> {
- List<Map<String, Object>> clickEditingTriggerQuery(Integer rawUnacceptedId);
+ List<UpdateInspectUnacceptedDto> clickEditingTriggerQuery(Integer rawUnacceptedId);
Integer updateOpinion(List<Opinion> opinion);
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InspectUnaccepted.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InspectUnaccepted.java
index abeaf24..0aaa0e6 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/InspectUnaccepted.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/InspectUnaccepted.java
@@ -32,7 +32,7 @@
@TableId(type = IdType.AUTO)
private Integer id;
- @ApiModelProperty(value = "0锛氭垚鍝佹楠屽崟锛涘崐鎴愬搧妫�楠屽崟锛�1锛氬師鏉愭枡妫�楠屽崟")
+ @ApiModelProperty(value = "1锛氭垚鍝佹楠屽崟锛�2鍗婃垚鍝佹楠屽崟锛�0锛氬師鏉愭枡妫�楠屽崟")
private Integer type;
/**
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/Opinion.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/Opinion.java
index e64674a..59ff5bc 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/Opinion.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/Opinion.java
@@ -48,9 +48,9 @@
@ApiModelProperty(value = "澶勭悊鎰忚", required = true, example = "杩斿伐")
private String tell;
- @NotBlank(message = "澶勭悊鏂瑰紡涓嶈兘涓虹┖锛�")
- @ApiModelProperty(value = "澶勭悊鏂瑰紡锛�0锛氳繑宸ワ紱1锛氳繑淇紱2锛氳姝ユ帴鏀讹紱3锛氭嫆鏀讹紱4锛氶檷绾т娇鐢紱5锛氭姤搴�", required = true, example = "杩斿伐")
- private String way;
+ @NotNull(message = "澶勭悊鏂瑰紡涓嶈兘涓虹┖锛�")
+ @ApiModelProperty(value = "澶勭悊鏂瑰紡锛�0锛氳繑宸ワ紱1锛氳繑淇紱2锛氳姝ユ帴鏀讹紱3锛氭嫆鏀讹紱4锛氶檷绾т娇鐢紱5锛氭姤搴�", required = true, example = "0")
+ private Integer way;
@ApiModelProperty(value = "閫昏緫鍒犻櫎", hidden = true)
@TableLogic(value = "1", delval = "0")
@@ -69,7 +69,7 @@
private Date updateTime;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
- @ApiModelProperty(value = "濉啓鏃ユ湡", required = true, example = "2023-09-05", dataType = "date")
+ @ApiModelProperty(value = "濉啓鏃ユ湡", hidden = true, example = "2023-09-05", dataType = "date")
private Date fillDate;
@ApiModelProperty(value = "濉啓浜篒d", hidden = true, example = "1")
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/dto/UpdateInspectUnacceptedDto.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/dto/UpdateInspectUnacceptedDto.java
new file mode 100644
index 0000000..6d27d9c
--- /dev/null
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/dto/UpdateInspectUnacceptedDto.java
@@ -0,0 +1,15 @@
+package com.yuanchu.mom.pojo.dto;
+
+import lombok.Data;
+
+@Data
+public class UpdateInspectUnacceptedDto {
+
+ private Integer id;
+
+ private String tell;
+
+ private String type;
+
+ private Integer way;
+}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/InspectUnacceptedService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/InspectUnacceptedService.java
index 7945c23..8505445 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/InspectUnacceptedService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/InspectUnacceptedService.java
@@ -4,9 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yuanchu.mom.pojo.InspectUnaccepted;
-import com.yuanchu.mom.pojo.Opinion;
-import java.util.List;
import java.util.Map;
/**
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/OpinionService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/OpinionService.java
index 0a055ea..c7f28d8 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/OpinionService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/OpinionService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.pojo.Opinion;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@@ -20,7 +21,7 @@
public interface OpinionService extends IService<Opinion> {
@Transactional(rollbackFor = Exception.class)
- List<Map<String, Object>> clickEditingTriggerQuery(Integer rawUnacceptedId);
+ List<UpdateInspectUnacceptedDto> clickEditingTriggerQuery(Integer rawUnacceptedId);
/**
* 鎵归噺鏇存柊鎰忚
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
index 7794ad3..bb2ad6b 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/OpinionServiceImpl.java
@@ -7,6 +7,7 @@
import com.yuanchu.mom.pojo.InspectUnaccepted;
import com.yuanchu.mom.pojo.Opinion;
import com.yuanchu.mom.mapper.OpinionMapper;
+import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto;
import com.yuanchu.mom.service.OpinionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.utils.MyUtil;
@@ -14,6 +15,7 @@
import javax.annotation.Resource;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -32,8 +34,8 @@
private OpinionMapper opinionMapper;
@Override
- public List<Map<String, Object>> clickEditingTriggerQuery(Integer rawUnacceptedId) {
- List<Map<String, Object>> mapList = opinionMapper.clickEditingTriggerQuery(rawUnacceptedId);
+ public List<UpdateInspectUnacceptedDto> clickEditingTriggerQuery(Integer rawUnacceptedId) {
+ List<UpdateInspectUnacceptedDto> mapList = opinionMapper.clickEditingTriggerQuery(rawUnacceptedId);
if (mapList.size() == 0) {
List<Opinion> list = new ArrayList<>();
for (int i = 0; i <= 3; i++) {
@@ -52,6 +54,7 @@
public Integer updateOpinion(String id, List<Opinion> opinion) {
opinion.forEach(i -> {
i.setUserId(Integer.valueOf(id));
+ i.setFillDate(new Date());
});
return opinionMapper.updateOpinion(opinion);
}
diff --git a/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml b/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml
index 4e0ab3c..065f169 100644
--- a/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InspectUnacceptedMapper.xml
@@ -16,33 +16,7 @@
and type = 0
</update>
- <select id="selectUnRawInspectsList" resultType="java.util.Map">
- select ru.id,
- DATE_FORMAT(form_time, '%Y-%m-%d') '鏉ユ枡鏃ユ湡',
- reason,
- code,
- name,
- specifications,
- unit,
- number,
- DATE_FORMAT(ri.create_time, '%Y-%m-%d') '鎶ユ鏃ユ湡',
- user_name,
- DATE_FORMAT(ins_time, '%Y-%m-%d') '妫�楠屾棩鏈�',
- deal_state,
- deal_reasult,
- DATE_FORMAT(deal_time, '%Y-%m-%d') '澶勭悊鏃ユ湡'
- from mom_ocean.raw_inspect ri inner join mom_ocean.inspect_unaccepted ru on ri.id = ru.raw_inspect_id
- <where>
- <if test="dealState!=null and dealState!=''">
- and deal_state=#{dealState}
- </if>
- <if test="formTime!=null and formTime!=''">
- and form_time=#{formTime}
- </if>
- and ru.state=1
- </where>
- order by ru.id desc
- </select>
+ <!--涓嶅悎鏍肩鐞�-->
<select id="selectInsList" resultType="java.util.Map">
SELECT ru.id,
DATE_FORMAT(fi.create_time, '%Y-%m-%d') dateArrival,
@@ -57,7 +31,7 @@
u.name,
deal_state,
deal_reasult,
- DATE_FORMAT(deal_time, '%Y-%m-%d') processingDate
+ DATE_FORMAT(fi.update_time, '%Y-%m-%d') processingDate
FROM (inspect_unaccepted ru,
`user` u)
LEFT JOIN finished_inspect fi ON fi.`id` = ru.`raw_inspect_id`
@@ -65,8 +39,8 @@
AND ru.type = 1
AND ru.state=1
AND fi.`user_id` = u.`id`
- <if test="dealState!=null and dealState!=''">
- and deal_state=#{dealState}
+ <if test="dealState!=null">
+ and deal_state = #{dealState}
</if>
<if test="formTime!=null and formTime!=''">
and fi.create_time=#{formTime}
@@ -74,9 +48,10 @@
order by ru.id desc
</select>
+ <!--鍘熸潗鏂欎笉鍚堟牸-->
<select id="selectUnqualifiedRawMaterials" resultType="map">
SELECT i.id,
- DATE_FORMAT(r.create_time, '%Y-%m-%d') dateArrival,
+ DATE_FORMAT(r.form_time, '%Y-%m-%d') dateArrival,
i.`reason`,
r.`code`,
r.`name`,
@@ -94,7 +69,7 @@
WHERE i.`state` = 1
AND i.`type` = 0
<if test="formTime != null and formTime != ''">
- AND r.create_time = #{formTime}
+ AND r.form_time = #{formTime}
</if>
<if test="productName != null and productName != ''">
AND r.name LIKE CONCAT('%', #{productName}, '%')
@@ -108,22 +83,26 @@
ORDER BY i.`id` DESC
</select>
+ <!--涓嶅悎鏍煎缃�-->
<select id="selectDisposal" resultType="map">
SELECT i.`id`, s.`type`, s.name productName, s.`specifications`, s.number, i.`tell` description,
- o.`tell` opinions, s.user_name, DATE_FORMAT(i.`create_time`, '%Y-%m-%d') `date`, i.`deal_state`
- FROM (inspect_unaccepted i,
- (
- SELECT 2 AS `type`, r.`name`, r.`specifications`, r.`number`, r.`id`, r.`user_name`, 0 AS classify
+ o.`tell` opinions, s.user_name, DATE_FORMAT(i.`create_time`, '%Y-%m-%d') `date`, i.`deal_state`
+ FROM inspect_unaccepted i
+ LEFT JOIN
+ (
+ -- 鍘熸潗鏂�
+ SELECT 0 AS `type`, r.`name`, r.`specifications`, r.`number`, r.`id`, r.`user_name`
FROM raw_inspect r
WHERE r.state = 1
- <if test="specificationModel != null and specificationModel != ''">
- AND r.`specifications` LIKE CONCAT('%', #{specificationModel}, '%')
+ <if test="specificationModel != null and specificationModel != ''">AND r.`specifications` LIKE CONCAT('%',
+ #{specificationModel}, '%')
</if>
- <if test="productName != null and productName != ''">
- AND r.`name` LIKE CONCAT('%', #{productName}, '%')
+ <if test="
+ productName != null and productName != ''">AND r.`name` LIKE CONCAT('%', #{productName}, '%')
</if>
UNION ALL
- SELECT f.`type`, f.`project_name` `name`, f.`specifications_model` specifications, f.`quantity` number, f.`id`, u.name user_name, 1 AS classify
+ -- 鎴愬搧
+ SELECT 1 AS `type`, f.`project_name` `name`, f.`specifications_model` specifications, f.`quantity` `number`, f.`id`, u.name user_name
FROM finished_inspect f, `user` u
WHERE f.`state` = 1
AND u.id = f.user_id
@@ -133,16 +112,27 @@
<if test="productName != null and productName != ''">
AND f.`project_name` LIKE CONCAT('%', #{productName}, '%')
</if>
- ) AS s)
- LEFT JOIN opinion o ON i.`id` = o.`raw_unaccepted_id`
+ UNION ALL
+ -- 鍗婃垚鍝�
+ SELECT 2 AS `type`, p.`material` `name`, p.`specifications_model` specifications, p.`quantity` `number`, p.`id`, u.name user_name
+ FROM process_inspect p, `user` u
+ WHERE p.state = 1
+ AND u.id = p.user_id
+ <if test="specificationModel != null and specificationModel != ''">
+ AND p.`specifications_model` LIKE CONCAT('%', #{specificationModel}, '%')
+ </if>
+ <if test="productName != null and productName != ''">
+ AND p.`material` LIKE CONCAT('%', #{productName}, '%')
+ </if>
+ )AS s ON s.`id` = i.`raw_inspect_id` AND s.`type` = i.type
+ LEFT JOIN opinion o ON i.`id` = o.`raw_unaccepted_id`
WHERE i.`state` = 1
- AND i.`type` = s.`classify`
- AND s.`id` = i.`raw_inspect_id`
<if test="state != null">
AND i.`deal_state` = #{state}
</if>
<if test="productCategories != null">
AND s.`type` = #{productCategories}
</if>
+ ORDER BY i.id DESC
</select>
</mapper>
diff --git a/inspect-server/src/main/resources/mapper/OpinionMapper.xml b/inspect-server/src/main/resources/mapper/OpinionMapper.xml
index 8221360..718ce9d 100644
--- a/inspect-server/src/main/resources/mapper/OpinionMapper.xml
+++ b/inspect-server/src/main/resources/mapper/OpinionMapper.xml
@@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yuanchu.mom.mapper.OpinionMapper">
- <select id="clickEditingTriggerQuery" resultType="map">
- SELECT o.`id`, o.`tell`, o.`type`, o.`way`, o.`fill_date`
+ <select id="clickEditingTriggerQuery" resultType="updateInspectUnacceptedDto">
+ SELECT o.`id`, o.`tell`, o.`type`, o.`way`
FROM opinion o
LEFT JOIN `user` u ON o.`user_id` = u.`id`
WHERE o.`raw_unaccepted_id` = #{rawUnacceptedId}
@@ -32,6 +32,11 @@
WHEN o.id = #{item.id} THEN #{item.userId}
</foreach>
</trim>
+ <trim prefix="raw_unaccepted_id=case" suffix="end,">
+ <foreach collection="list" item="item" index="index">
+ WHEN o.id = #{item.id} THEN #{item.rawUnacceptedId}
+ </foreach>
+ </trim>
</trim>
WHERE o.id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
diff --git a/system-run/src/main/resources/application-dev.yml b/system-run/src/main/resources/application-dev.yml
index 9eccb15..af31743 100644
--- a/system-run/src/main/resources/application-dev.yml
+++ b/system-run/src/main/resources/application-dev.yml
@@ -34,7 +34,7 @@
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://192.168.65.113:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
+ url: jdbc:mysql://192.168.218.113:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
username: user
password: 123456
druid:
@@ -59,7 +59,7 @@
# redis鏁版嵁搴撶储寮�(榛樿涓�0)锛屾垜浠娇鐢ㄧ储寮曚负3鐨勬暟鎹簱锛岄伩鍏嶅拰鍏朵粬鏁版嵁搴撳啿绐�
database: 0
# redis鏈嶅姟鍣ㄥ湴鍧�锛堥粯璁や负localhost锛�
- host: 192.168.65.113
+ host: 192.168.218.113
# redis绔彛锛堥粯璁や负6379锛�
port: 6379
# redis璁块棶瀵嗙爜锛堥粯璁や负绌猴級
--
Gitblit v1.9.3