任务模块编写

main
dongdingding 2 months ago
parent aadf64cb69
commit 90cfb1285e

@ -190,6 +190,7 @@ public class AssetTaskController extends BaseController {
} else { } else {
//已报废 //已报废
assetCurrent.setStatus(5); assetCurrent.setStatus(5);
assetCurrent.setXtzt("5");
} }
StringBuilder a = new StringBuilder(); StringBuilder a = new StringBuilder();
if (!assetCurrent.getGlymList().isEmpty()) { if (!assetCurrent.getGlymList().isEmpty()) {
@ -266,12 +267,12 @@ public class AssetTaskController extends BaseController {
assetLc.setTaskId(assetCurrent.getTaskId()); assetLc.setTaskId(assetCurrent.getTaskId());
assetLc.setAssetName(assetCurrent.getXtmc()); assetLc.setAssetName(assetCurrent.getXtmc());
//当审核状态为审核不通过 单位端重新提交 //当审核状态为审核不通过 单位端重新提交
if (assetCurrent.getStatus().equals(4)) { // if (assetCurrent.getStatus().equals(4)) {
assetLc.setTaskId(assetCurrent.getTaskId()); // assetLc.setTaskId(assetCurrent.getTaskId());
assetLc.setXfTime(LocalDateTime.now()); // assetLc.setXfTime(LocalDateTime.now());
assetLc.setAssetName("单位重新核查提交时间" + assetCurrent.getXtmc()); // assetLc.setAssetName("单位重新核查提交时间" + assetCurrent.getXtmc());
assetLcService.insert(assetLc); // assetLcService.insert(assetLc);
} // }
StringBuilder a = new StringBuilder(); StringBuilder a = new StringBuilder();
if (!assetCurrent.getGlymList().isEmpty()) { if (!assetCurrent.getGlymList().isEmpty()) {

@ -34,7 +34,7 @@ import java.util.List;
*/ */
@Api(tags = "单位表控制层") @Api(tags = "单位表控制层")
@RestController @RestController
@PreAuthorize("@ss.hasAnyRoles('admin,common')") //@PreAuthorize("@ss.hasAnyRoles('admin,common')")
@RequestMapping("/tc/unit") @RequestMapping("/tc/unit")
public class UnitController { public class UnitController {

@ -27,10 +27,7 @@ public class AssetBusinessFormCpPo extends BaseClass implements Serializable {
@TableId(type = IdType.AUTO,value = "business_id") @TableId(type = IdType.AUTO,value = "business_id")
private Long businessId; private Long businessId;
/**
* id
*/
private Long id;
/** /**
* id * id
*/ */

@ -13,7 +13,7 @@ public class UnitRequest {
@ApiModelProperty("1 查询已有资产的单位") @ApiModelProperty("1 查询已有资产的单位")
private String isSearch; private int isSearch;
@ApiModelProperty("统一社会信用代码") @ApiModelProperty("统一社会信用代码")
private String userName; private String userName;

@ -125,7 +125,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
if (bussList != null) { if (bussList != null) {
for (AssetBusinessFormCpPo assetBusinessFormCpResponse : bussList) { for (AssetBusinessFormCpPo assetBusinessFormCpResponse : bussList) {
if (assetCurrentResponse.getXjgywxt() != null) { if (assetCurrentResponse.getXjgywxt() != null) {
assetCurrentResponse.getXjgywxt().setAssetId(assetBusinessFormCpResponse.getId()); assetCurrentResponse.getXjgywxt().setAssetId(assetBusinessFormCpResponse.getAssetId());
assetCurrentResponse.getXjgywxt().setTaskId(id); assetCurrentResponse.getXjgywxt().setTaskId(id);
assetBusinessFormCpResponseList.add(assetCurrentResponse.getXjgywxt()); assetBusinessFormCpResponseList.add(assetCurrentResponse.getXjgywxt());
} }
@ -137,7 +137,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
if (supplyChainList != null) { if (supplyChainList != null) {
for (AssetSupplyChainCpPo items : supplyChainList) { for (AssetSupplyChainCpPo items : supplyChainList) {
items.setAssetId(assetCurrentResponse.getId()); items.setAssetId(assetCurrentResponse.getId());
// items.setSupplyId(items.getSupplyId()); items.setSupplyId(items.getSupplyId());
items.setTaskId(id); items.setTaskId(id);
//新增供应链 //新增供应链
} }
@ -148,7 +148,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
for (AssetBasicNetworkCpPo items : BasicNetworkCpList) { for (AssetBasicNetworkCpPo items : BasicNetworkCpList) {
//根据资产id查询基础网络主表id //根据资产id查询基础网络主表id
items.setAssetId(assetCurrentResponse.getId()); items.setAssetId(assetCurrentResponse.getId());
// items.setNetworkId(items.getNetworkId()); items.setNetworkId(items.getNetworkId());
items.setTaskId(id); items.setTaskId(id);
//新增基础网络 //新增基础网络
} }
@ -159,7 +159,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
for (UnitOtherConcatCpPo items : unitOtherConcatList) { for (UnitOtherConcatCpPo items : unitOtherConcatList) {
//根据资产id查询其他联系人主表id //根据资产id查询其他联系人主表id
items.setAssetId(assetCurrentResponse.getId()); items.setAssetId(assetCurrentResponse.getId());
// items.setConcatId(items.getConcatId()); items.setConcatId(items.getConcatId());
items.setTaskId(id); items.setTaskId(id);
//新增其他联系人 //新增其他联系人
} }
@ -220,7 +220,12 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
@Override @Override
public Page<AssestTaskXqresponse> zcHc(Page<AssestTaskXqresponse> assetTask, AssestTaskXqRequest pageRequest) { public Page<AssestTaskXqresponse> zcHc(Page<AssestTaskXqresponse> assetTask, AssestTaskXqRequest pageRequest) {
assetTask.setOptimizeCountSql(false); assetTask.setOptimizeCountSql(false);
return assetTaskDao.zcHc(assetTask, pageRequest); Page<AssestTaskXqresponse> result = assetTaskDao.zcHc(assetTask, pageRequest);
// 确保 records 不为 null
if (result.getRecords() == null) {
result.setRecords(new ArrayList<>()); // 设置为空数组
}
return result;
} }
@Override @Override
@ -247,6 +252,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3); boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3);
boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6); boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6);
boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4); boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4);
boolean hased = list.stream().anyMatch(item -> item.getStatus() == 5);
LocalDateTime finishTime = null; LocalDateTime finishTime = null;
if (hasPendingApproval) { if (hasPendingApproval) {
// 资产状态存在待审批,任务状态为进行中 // 资产状态存在待审批,任务状态为进行中
@ -263,7 +269,18 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
taskSaveOrDelete(req); taskSaveOrDelete(req);
} else if (hasRejected) { } else if (hasRejected) {
// 审核不通过 // 审核不通过
taskStatus = 4; taskStatus = 1;
} else if (hased && !hasRejected && !hasExpired) {
//存在已报废并且其他都已完成 且未超期
taskStatus = 2;
finishTime = LocalDateTime.now();
taskSaveOrDelete(req);
}
else if(hased && !hasRejected && hasExpired){
//存在已报废并且其他都已完成 且未超期
taskStatus = 3;
finishTime = LocalDateTime.now();
taskSaveOrDelete(req);
} }
//修改主表任务状态 //修改主表任务状态
assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime); assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime);

@ -8,7 +8,7 @@
<select id="page" resultType="com.ruoyi.tc.entity.AssetCurrent"> <select id="page" resultType="com.ruoyi.tc.entity.AssetCurrent">
select * from asset_current select * from asset_current
<where> <where>
del_flag = '0' and isbf = '0' del_flag = '0'
<if test="req.xtmc!=null and req.xtmc!='' "> <if test="req.xtmc!=null and req.xtmc!='' ">
and xtmc like concat('%',#{req.xtmc},'%') and xtmc like concat('%',#{req.xtmc},'%')
</if> </if>

@ -177,7 +177,7 @@
and task_name = #{req.taskName} and task_name = #{req.taskName}
</if> </if>
<if test="req.dwmc != null and req.dwmc != ''"> <if test="req.dwmc != null and req.dwmc != ''">
and dwmc = #{req.dwmc} and dwmc like concat('%',#{req.dwmc},'%')
</if> </if>
<if test="req.begainTime != null"> <if test="req.begainTime != null">
and task_finish_time &gt;= #{req.begainTime} and task_finish_time &gt;= #{req.begainTime}
@ -191,7 +191,9 @@
<if test="req.id != null "> <if test="req.id != null ">
and id = #{req.id} and id = #{req.id}
</if> </if>
</where> </where>
order by task_time desc
</select> </select>
<select id="findByDwmcAssetCurrent" resultType="com.ruoyi.tc.entity.po.AssetCurrentCpPo"> <select id="findByDwmcAssetCurrent" resultType="com.ruoyi.tc.entity.po.AssetCurrentCpPo">
select * from asset_current select * from asset_current
@ -239,7 +241,7 @@
dwmc, dwmc,
COUNT(*) AS total, COUNT(*) AS total,
SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS notChecked, SUM(CASE WHEN status = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS checked, SUM(CASE WHEN status = 3 or status = 5 THEN 1 ELSE 0 END) AS checked,
ROUND( ROUND(
CASE CASE
WHEN COUNT(*) > 0 THEN WHEN COUNT(*) > 0 THEN
@ -259,15 +261,15 @@
</select> </select>
<select id="findByTaskId" resultType="com.ruoyi.tc.entity.response.AssetTaskStatusResponse"> <select id="findByTaskId" resultType="com.ruoyi.tc.entity.response.AssetTaskStatusResponse">
SELECT SELECT
a.status, a.STATUS,
CASE CASE
WHEN a.update_time > b.task_deadline THEN '6'
ELSE '7' WHEN DATE ( a.update_time ) > b.task_deadline THEN
'6' ELSE '7'
END AS deadstatus END AS deadstatus
FROM FROM
asset_current_cp a asset_current_cp a
LEFT JOIN LEFT JOIN asset_task b ON a.task_id = b.id
asset_task b ON a.task_id = b.id
<where> <where>
<if test="taskId!=null "> <if test="taskId!=null ">
and a.task_id =#{taskId} and a.task_id =#{taskId}

@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM asset_task FROM asset_task
<where> <where>
task_status = 1 AND FIND_IN_SET(a.nick_name, dwmc) task_status = 1 AND FIND_IN_SET(a.nick_name, dwmc)
) AND a.del_flag = '0' ) AND a.del_flag = '0' and a.nick_name IN (SELECT dwmc FROM asset_current)
<if test="req.nickName != null and req.nickName != '' "> <if test="req.nickName != null and req.nickName != '' ">
and a.nick_name like concat('%',#{req.nickName},'%') and a.nick_name like concat('%',#{req.nickName},'%')
</if> </if>
@ -131,6 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and a.user_name like concat('%',#{req.userName},'%') and a.user_name like concat('%',#{req.userName},'%')
</if> </if>
</where> </where>
</select> </select>
<update id="deleteUnits"> <update id="deleteUnits">
update unit_info set del_flag = '2' where id = #{id} update unit_info set del_flag = '2' where id = #{id}

Loading…
Cancel
Save