This commit is contained in:
parent
5a787c9de0
commit
2ca49c4884
|
|
@ -84,4 +84,16 @@ public class RepairController extends BaseController {
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "审核")
|
||||||
|
@PostMapping("/auditData")
|
||||||
|
public AjaxResult auditData(@RequestBody ToBeRepair bean) {
|
||||||
|
return service.auditData(bean);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,4 +128,9 @@ public class ToBeRepair {
|
||||||
* 结束时间
|
* 结束时间
|
||||||
*/
|
*/
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核状态
|
||||||
|
*/
|
||||||
|
private String auditStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,18 @@ public interface RepairMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ToBeRepair> getRepairDetailsList(ToBeRepair bean);
|
List<ToBeRepair> getRepairDetailsList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核数据
|
||||||
|
* @param toBeRepair
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int auditData(ToBeRepair toBeRepair);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取详情列表
|
||||||
|
* @param toBeRepair
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ToBeRepair> getDetailsList(ToBeRepair toBeRepair);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,4 +43,11 @@ public interface RepairService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ToBeRepair> getRepairDetailsList(ToBeRepair bean);
|
List<ToBeRepair> getRepairDetailsList(ToBeRepair bean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核数据
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult auditData(ToBeRepair bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -96,13 +97,49 @@ public class RepairServiceImpl implements RepairService {
|
||||||
@Override
|
@Override
|
||||||
public List<ToBeRepair> getRepairList(ToBeRepair bean) {
|
public List<ToBeRepair> getRepairList(ToBeRepair bean) {
|
||||||
try {
|
try {
|
||||||
return mapper.getRepairList(bean);
|
List<ToBeRepair> list = mapper.getRepairList(bean);
|
||||||
|
for (ToBeRepair toBeRepair : list) {
|
||||||
|
List<ToBeRepair> detailsList = mapper.getDetailsList(toBeRepair);
|
||||||
|
if (detailsList != null && !detailsList.isEmpty()) {
|
||||||
|
// 存在审核中
|
||||||
|
boolean hasZero = false;
|
||||||
|
// 是否全部驳回
|
||||||
|
boolean allTwo = true;
|
||||||
|
for (ToBeRepair detail : detailsList) {
|
||||||
|
String audit = detail.getAuditStatus();
|
||||||
|
if ("0".equals(audit)) {
|
||||||
|
hasZero = true;
|
||||||
|
}
|
||||||
|
if (!"2".equals(audit)) {
|
||||||
|
allTwo = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 规则判断
|
||||||
|
if (hasZero) {
|
||||||
|
toBeRepair.setStatus("审核中");
|
||||||
|
} else if (allTwo) {
|
||||||
|
toBeRepair.setStatus("已驳回");
|
||||||
|
} else {
|
||||||
|
toBeRepair.setStatus("已审核");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String statusFilter = bean.getStatus();
|
||||||
|
if (statusFilter != null && !"".equals(statusFilter)) {
|
||||||
|
list = list.stream()
|
||||||
|
.filter(item -> statusFilter.equals(item.getStatus()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult deleteRepairList(ToBeRepair bean) {
|
public AjaxResult deleteRepairList(ToBeRepair bean) {
|
||||||
|
|
@ -135,6 +172,30 @@ public class RepairServiceImpl implements RepairService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult auditData(ToBeRepair bean) {
|
||||||
|
try {
|
||||||
|
if (bean.getToBeRepairList().size() <= 0) {
|
||||||
|
return AjaxResult.error("请选择审核数据");
|
||||||
|
}
|
||||||
|
String username = SecurityUtils.getLoginUser().getSysUser().getNickName();
|
||||||
|
for (ToBeRepair toBeRepair : bean.getToBeRepairList()) {
|
||||||
|
toBeRepair.setCreateUser(username);
|
||||||
|
int res = mapper.auditData(toBeRepair);
|
||||||
|
if (res <= 0) {
|
||||||
|
throw new Exception("审核数据失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.success("审核成功");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return AjaxResult.error("审核失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成任务编号
|
* 生成任务编号
|
||||||
* @param thisMonthMaxOrder
|
* @param thisMonthMaxOrder
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
<if test="scrapUrl != null and scrapUrl!=''">reason_url,</if>
|
<if test="scrapUrl != null and scrapUrl!=''">reason_url,</if>
|
||||||
<if test="isScrap != null and isScrap!=''">is_scrap,</if>
|
<if test="isScrap != null and isScrap!=''">is_scrap,</if>
|
||||||
<if test="createUser != null">create_user,</if>
|
<if test="createUser != null">create_user,</if>
|
||||||
|
review_status,
|
||||||
create_time
|
create_time
|
||||||
)
|
)
|
||||||
values (
|
values (
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
<if test="scrapUrl != null and scrapUrl!=''">#{scrapUrl},</if>
|
<if test="scrapUrl != null and scrapUrl!=''">#{scrapUrl},</if>
|
||||||
<if test="isScrap != null and isScrap!=''">#{isScrap},</if>
|
<if test="isScrap != null and isScrap!=''">#{isScrap},</if>
|
||||||
<if test="createUser != null">#{createUser},</if>
|
<if test="createUser != null">#{createUser},</if>
|
||||||
|
'0',
|
||||||
NOW()
|
NOW()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
@ -46,6 +48,13 @@
|
||||||
<update id="deleteChangeDetails">
|
<update id="deleteChangeDetails">
|
||||||
update cs_device_change_details set del_flag = '1' where change_id = #{id}
|
update cs_device_change_details set del_flag = '1' where change_id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="auditData">
|
||||||
|
update cs_device_change_details
|
||||||
|
set review_status = #{auditStatus},
|
||||||
|
review_by = #{createUser},
|
||||||
|
review_time=NOW()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="selectToBeRepairList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
<select id="selectToBeRepairList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -57,7 +66,6 @@
|
||||||
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
||||||
tt4.type_name as typeName,
|
tt4.type_name as typeName,
|
||||||
tt5.type_name as typeModelName,
|
tt5.type_name as typeModelName,
|
||||||
|
|
||||||
CASE tl.manage_mode
|
CASE tl.manage_mode
|
||||||
WHEN 0 THEN
|
WHEN 0 THEN
|
||||||
'编码管理'
|
'编码管理'
|
||||||
|
|
@ -138,20 +146,12 @@
|
||||||
WHEN 2 THEN cdcd.num
|
WHEN 2 THEN cdcd.num
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END) as toolNum,
|
END) as toolNum,
|
||||||
CASE review_status
|
|
||||||
WHEN 0 THEN '审核中'
|
|
||||||
WHEN 1 THEN '已通过'
|
|
||||||
WHEN 2 THEN '已驳回'
|
|
||||||
END as `status`,
|
|
||||||
cdc.create_user as createUser,
|
cdc.create_user as createUser,
|
||||||
cdc.create_time as createTime
|
cdc.create_time as createTime
|
||||||
FROM cs_device_change cdc
|
FROM cs_device_change cdc
|
||||||
LEFT JOIN cs_device_change_details cdcd ON cdcd.change_id = cdc.id
|
LEFT JOIN cs_device_change_details cdcd ON cdcd.change_id = cdc.id
|
||||||
WHERE cdc.type = '4'
|
WHERE cdc.type = '4'
|
||||||
and cdc.del_flag='0'
|
and cdc.del_flag='0'
|
||||||
<if test="status != null and status!=''">
|
|
||||||
AND cdc.review_status = #{status}
|
|
||||||
</if>
|
|
||||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
||||||
AND cdc.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
AND cdc.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -159,27 +159,36 @@
|
||||||
ORDER BY cdc.create_time DESC
|
ORDER BY cdc.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
<select id="getRepairDetailsList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
<select id="getRepairDetailsList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||||
SELECT '工具' as type,
|
SELECT DISTINCT cdcd.id,
|
||||||
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
'工具' as type,
|
||||||
tt4.type_name as typeName,
|
CONCAT(tt2.type_name, '/', tt3.type_name, '/', tt4.type_name) AS groupName,
|
||||||
tt5.type_name as typeModelName,
|
tt4.type_name as typeName,
|
||||||
CASE
|
tt5.type_name as typeModelName,
|
||||||
WHEN cdcd.dev_code is null THEN
|
CASE
|
||||||
'数量管理'
|
WHEN cdcd.dev_code is null THEN
|
||||||
ELSE
|
'数量管理'
|
||||||
'编码管理'
|
ELSE
|
||||||
END manageMode,
|
'编码管理'
|
||||||
cdcd.dev_code as `code`,
|
END manageMode,
|
||||||
cdcd.num as repairNum,
|
cdcd.dev_code as `code`,
|
||||||
cdcd.is_scrap as isScrap,
|
cdcd.num as repairNum,
|
||||||
cdcd.repair_time as repairTime,
|
cdcd.is_scrap as isScrap,
|
||||||
cdcd.reason_val as reasonVal,
|
CASE cdcd.review_status
|
||||||
CASE is_scrap
|
WHEN 0 THEN
|
||||||
WHEN 0 THEN
|
'待审核'
|
||||||
repair_url
|
WHEN 1 THEN
|
||||||
ELSE
|
'通过'
|
||||||
reason_url
|
WHEN 2 THEN
|
||||||
END url
|
'驳回'
|
||||||
|
END status,
|
||||||
|
cdcd.repair_time as repairTime,
|
||||||
|
cdcd.reason_val as reasonVal,
|
||||||
|
CASE is_scrap
|
||||||
|
WHEN 0 THEN
|
||||||
|
repair_url
|
||||||
|
ELSE
|
||||||
|
reason_url
|
||||||
|
END url
|
||||||
FROM cs_device_change_details cdcd
|
FROM cs_device_change_details cdcd
|
||||||
LEFT JOIN tool_type tt5 on tt5.type_id = cdcd.dev_type_id
|
LEFT JOIN tool_type tt5 on tt5.type_id = cdcd.dev_type_id
|
||||||
LEFT JOIN tool_type tt4 on tt4.type_id = tt5.parent_id
|
LEFT JOIN tool_type tt4 on tt4.type_id = tt5.parent_id
|
||||||
|
|
@ -187,14 +196,15 @@
|
||||||
LEFT JOIN tool_type tt2 on tt2.type_id = tt3.parent_id
|
LEFT JOIN tool_type tt2 on tt2.type_id = tt3.parent_id
|
||||||
WHERE cdcd.change_id = #{id}
|
WHERE cdcd.change_id = #{id}
|
||||||
and cdcd.dev_type = '2'
|
and cdcd.dev_type = '2'
|
||||||
and cdcd.del_flag='0'
|
and cdcd.del_flag = '0'
|
||||||
GROUP BY cdcd.id
|
GROUP BY cdcd.id
|
||||||
|
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
|
|
||||||
SELECT DISTINCT '装备' as type,
|
SELECT DISTINCT cdcd.id,
|
||||||
|
'装备' as type,
|
||||||
CONCAT(mt2.type_name, '/', mt3.type_name, '/', mt4.type_name) AS groupName,
|
CONCAT(mt2.type_name, '/', mt3.type_name, '/', mt4.type_name) AS groupName,
|
||||||
mdi.device_name as typeName,
|
mdi.device_name as typeName,
|
||||||
mdi.item_type_model as typeModelName,
|
mdi.item_type_model as typeModelName,
|
||||||
|
|
@ -207,6 +217,14 @@
|
||||||
cdcd.dev_code as `code`,
|
cdcd.dev_code as `code`,
|
||||||
cdcd.num as repairNum,
|
cdcd.num as repairNum,
|
||||||
cdcd.is_scrap as isScrap,
|
cdcd.is_scrap as isScrap,
|
||||||
|
CASE cdcd.review_status
|
||||||
|
WHEN 0 THEN
|
||||||
|
'待审核'
|
||||||
|
WHEN 1 THEN
|
||||||
|
'通过'
|
||||||
|
WHEN 2 THEN
|
||||||
|
'驳回'
|
||||||
|
END status,
|
||||||
cdcd.repair_time as repairTime,
|
cdcd.repair_time as repairTime,
|
||||||
cdcd.reason_val as reasonVal,
|
cdcd.reason_val as reasonVal,
|
||||||
CASE is_scrap
|
CASE is_scrap
|
||||||
|
|
@ -223,7 +241,16 @@
|
||||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt3.parent_id
|
LEFT JOIN ma_type mt2 on mt2.type_id = mt3.parent_id
|
||||||
WHERE cdcd.change_id = #{id}
|
WHERE cdcd.change_id = #{id}
|
||||||
and cdcd.dev_type = '1'
|
and cdcd.dev_type = '1'
|
||||||
and cdcd.del_flag='0'
|
and cdcd.del_flag = '0'
|
||||||
GROUP BY cdcd.id
|
GROUP BY cdcd.id
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getDetailsList" resultType="com.bonus.material.repair.domain.ToBeRepair">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
review_status as auditStatus
|
||||||
|
FROM
|
||||||
|
cs_device_change_details
|
||||||
|
WHERE
|
||||||
|
change_id=#{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue