领料申请驳回代码提交

This commit is contained in:
liang.chao 2024-01-10 09:03:26 +08:00
parent 4e7c28d3ce
commit d7b78162ec
9 changed files with 169 additions and 51 deletions

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.base.api.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -84,7 +85,7 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value="创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
@ -98,7 +99,7 @@ public class TmTask implements Serializable {
*/
@ApiModelProperty(value="更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/**

View File

@ -238,11 +238,24 @@ public class Convert
return toNumber(value, null);
}
/**
* 转换为int<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Integer toInt(Object value)
{
return toInt(value, null);
}
/**
* 转换为int<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@ -276,19 +289,6 @@ public class Convert
}
}
/**
* 转换为int<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Integer toInt(Object value)
{
return toInt(value, null);
}
/**
* 转换为Integer数组<br>
*

View File

@ -19,33 +19,25 @@ import reactor.core.publisher.Mono;
*/
@Order(-1)
@Configuration
public class GatewayExceptionHandler implements ErrorWebExceptionHandler
{
public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GatewayExceptionHandler.class);
@Override
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex)
{
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
ServerHttpResponse response = exchange.getResponse();
if (exchange.getResponse().isCommitted())
{
if (exchange.getResponse().isCommitted()) {
return Mono.error(ex);
}
String msg;
if (ex instanceof NotFoundException)
{
if (ex instanceof NotFoundException) {
msg = "服务未找到";
}
else if (ex instanceof ResponseStatusException)
{
} else if (ex instanceof ResponseStatusException) {
ResponseStatusException responseStatusException = (ResponseStatusException) ex;
msg = responseStatusException.getMessage();
}
else
{
} else {
msg = "内部服务器错误";
}

View File

@ -97,6 +97,7 @@
<version>5.8.18</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -15,6 +15,9 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import com.bonus.sgzb.common.security.annotation.Logical;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
import com.bonus.sgzb.common.security.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -51,6 +54,7 @@ public class TmTaskController extends BaseController {
/**
* 领料审核分公司分管机具分公司统一接口
*
* @param task 审核信息
* @return 结果
*/
@ -60,6 +64,19 @@ public class TmTaskController extends BaseController {
return toAjax(tmTaskService.updateLeaseTaskAuditInfo(task));
}
/**
* 领料驳回分公司分管机具分公司统一接口
*
* @param task
* @return
*/
@Log(title = "领料驳回", businessType = BusinessType.UPDATE)
@PostMapping("rejectLeaseByCompany")
public AjaxResult rejectLeaseByCompany(@RequestBody TmTask task) {
return toAjax(tmTaskService.updateLeaseTaskRejectInfo(task));
}
/**
* 根据任务id删除任务表及任务信息
*/
@ -162,7 +179,9 @@ public class TmTaskController extends BaseController {
}
}
}
if (StringUtils.isEmpty(taskId)) { return AjaxResult.error("任务编号为空,创建失败"); }
if (StringUtils.isEmpty(taskId)) {
return AjaxResult.error("任务编号为空,创建失败");
}
} else {
return AjaxResult.error("创建任务失败");
}
@ -175,6 +194,7 @@ public class TmTaskController extends BaseController {
/**
* 机具分公司直接创建领料申请
*
* @param task 任务信息
* @return 结果
*/
@ -234,7 +254,9 @@ public class TmTaskController extends BaseController {
}
}
}
if (StringUtils.isEmpty(taskId)) { return AjaxResult.error("任务编号为空,创建失败"); }
if (StringUtils.isEmpty(taskId)) {
return AjaxResult.error("任务编号为空,创建失败");
}
} else {
return AjaxResult.error("创建任务失败");
}
@ -247,11 +269,13 @@ public class TmTaskController extends BaseController {
/**
* 查询机具领料审核列表 - 后台
*
* @param task 筛选条件
* @return 列表
*/
@Log(title = "查询机具领料审核列表- 后台", businessType = BusinessType.QUERY)
@GetMapping(value = "getLeaseAuditListAll")
@RequiresRoles(value = {"admin", "kg", "fgs", "nbry"}, logical = Logical.OR)
public AjaxResult getLeaseAuditListAll(TmTask task) {
if (StringUtils.isNull(task)) {
return AjaxResult.error("参数错误");
@ -263,6 +287,7 @@ public class TmTaskController extends BaseController {
/**
* 查询机具领料审核列表 - app
*
* @param task 筛选条件
* @return 列表
*/
@ -288,7 +313,7 @@ public class TmTaskController extends BaseController {
try {
int taskResult = tmTaskService.updateByPrimaryKeySelective(task);
if (taskResult > 0) {
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())){
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())) {
return AjaxResult.error("任务表修改完成,但领料任务明细为空,执行失败!");
}
// 修改任务关联的协议
@ -296,9 +321,9 @@ public class TmTaskController extends BaseController {
//修改领料任务表信息
//先判断 目前数据库有几个公司
List<LeaseApplyInfo> list = tmTaskService.getListSome(task.getTaskId());
List<LeaseApplyInfo> list = tmTaskService.getListSome(task.getTaskId());
LeaseApplyInfo infoAdd = new LeaseApplyInfo();
if(list.size()<2){
if (list.size() < 2) {
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId");
infoAdd.setTaskId(task.getTaskId().intValue());
infoAdd.setCode(task.getLeaseApplyInfoList().get(0).getCode());
@ -307,11 +332,11 @@ public class TmTaskController extends BaseController {
infoAdd.setRemark(task.getLeaseApplyInfoList().get(0).getRemark());
infoAdd.setType(task.getLeaseApplyInfoList().get(0).getType());
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
if(leaseApplyDetailsList.get(0).getParenntId() == null ){
if(leaseApplyDetailsList.get(0).getCompanyId()==101){
if (leaseApplyDetailsList.get(0).getParenntId() == null) {
if (leaseApplyDetailsList.get(0).getCompanyId() == 101) {
infoAdd.setCompanyId(101);
leaseApplyInfoService.genderLeaseCode(infoAdd);
}else if(leaseApplyDetailsList.get(0).getCompanyId()==102){
} else if (leaseApplyDetailsList.get(0).getCompanyId() == 102) {
infoAdd.setCompanyId(102);
leaseApplyInfoService.genderLeaseCode(infoAdd);
}
@ -337,9 +362,9 @@ public class TmTaskController extends BaseController {
// 删除后,插入新地领料任务明细
if (StringUtils.isNotNull(leaseApplyInfo.getId())) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyInfo.getLeaseApplyDetails()) {
if(leaseApplyDetails.getParenntId() == null){
if (leaseApplyDetails.getParenntId() == null) {
leaseApplyDetails.setParenntId(infoAdd.getId());
}else{
} else {
leaseApplyDetails.setParenntId(leaseApplyInfo.getId()); // 设置领料任务ID
}
@ -361,20 +386,20 @@ public class TmTaskController extends BaseController {
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public TmTask selectOne(Integer id) {
return tmTaskService.selectByPrimaryKey(Long.valueOf(id));
return tmTaskService.selectByPrimaryKey(Long.valueOf(id));
}
@Log(title = "获取领料申请-详情列表", businessType = BusinessType.QUERY)
@GetMapping("/getLeaseListAll")
public TableDataInfo getLeaseListAll(@RequestParam(value ="taskId", required = false, defaultValue = "") String taskId){
public TableDataInfo getLeaseListAll(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId) {
TmTask task = new TmTask();
task.setTaskId(Long.parseLong(taskId));
List<TmTask> leaseAuditList = tmTaskService.getLeaseListAll(task);

View File

@ -36,9 +36,15 @@ public interface TmTaskMapper {
/** 更新LeaseApplyInfo审批信息 */
int updateLeaseApplyInfoAuditInfo(@Param("record") LeaseApplyInfo record);
/** 更新LeaseApplyInfo驳回信息 */
int updateLeaseApplyInfoRejectInfo(@Param("record") LeaseApplyInfo record);
/** 更新leaseApplyDetails审批信息 */
int updateLeaseApplyDetailsAuditInfo(@Param("record") LeaseApplyDetails record);
/** 更新leaseApplyDetails驳回信息 */
int updateLeaseApplyDetailsRejectInfo(@Param("record") LeaseApplyDetails record);
int deleteTaskByPrimaryKey(String taskId);
int deleteTaskInfoByTaskId(String taskId);

View File

@ -22,6 +22,8 @@ public interface TmTaskService{
/** 领料任务审核状态修改 */
int updateLeaseTaskAuditInfo(TmTask record);
int updateLeaseTaskRejectInfo(TmTask record);
String genderLeaseCode();
AjaxResult deleteByPrimaryKey(String taskId);

View File

@ -105,6 +105,41 @@ public class TmTaskServiceImpl implements TmTaskService{
return result;
}
/**
* 领料任务驳回
*
* @param record 审核数据及信息
*/
@Override
@Transactional
public int updateLeaseTaskRejectInfo(TmTask record) {
int result = 0;
if (StringUtils.isNotNull(record)) {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 再审核领料任务信息表
if (CollUtil.isNotEmpty(record.getLeaseApplyInfoList())) {
for (LeaseApplyInfo leaseApplyInfo : record.getLeaseApplyInfoList()) {
if (leaseApplyInfo != null) {
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoRejectInfo(leaseApplyInfo);
// 再审核领料任务详情表
if (CollUtil.isNotEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyInfo.getLeaseApplyDetails()) {
if (StringUtils.isNotNull(leaseApplyDetails)) {
result += tmTaskMapper.updateLeaseApplyDetailsRejectInfo(leaseApplyDetails);
}
}
}
}
}
}
} else {
return 0;
}
return result;
}
@Override
public String genderLeaseCode() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

View File

@ -456,13 +456,17 @@
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
SELECT DISTINCT
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
bpl.lot_id as proId,bpl.lot_name as proName,
bpl.lot_id as proId,bpl.lot_name as proName,
bui.unit_id as unitId,bui.unit_name as unitName,
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,
case when d.id = '30' then lai.company_audit_remark
when d.id = '31' then lai.dept_audit_remark
when d.id = '32' then lai.direct_audit_remark end examineStatus ,
d.id as examineStatusId,
when d.id = '32' then lai.direct_audit_remark
when d.id = '98' then lai.company_audit_remark
when d.id = '99' then lai.dept_audit_remark
when d.id = '100' then lai.direct_audit_remark
end examineStatus ,
d.id as examineStatusId,
bai.agreement_code as agreementCode,
tt.create_time as createTimes, tt.update_time as updateTimes
FROM
@ -496,7 +500,7 @@
<if test="record.keyWord != null and record.keyWord != ''">
AND bai.agreement_code like concat('%', #{record.keyWord}, '%')
</if>
ORDER BY tt.update_time DESC
ORDER BY tt.update_time DESC
</select>
<select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
@ -608,11 +612,40 @@
update_by = #{record.companyAuditBy},
update_time = now(),
</if>
<if test="record.examineStatusId == 35 and record.examineStatusId == '35'">
update_by = #{record.companyAuditBy},
update_time = now(),
</if>
</trim>
WHERE
task_id = #{record.taskId}
</update>
<update id="updateLeaseApplyInfoRejectInfo">
UPDATE
lease_apply_info
set
<trim suffixOverrides=",">
<if test="record.examineStatusId == 98 and record.examineStatusId == '98'">
company_audit_by = #{record.companyAuditBy},
company_audit_time = now(),
company_audit_remark = #{record.companyAuditRemark},
</if>
<if test="record.examineStatusId == 99 and record.examineStatusId == '99'">
dept_audit_by = #{record.companyAuditBy},
dept_audit_time = now(),
dept_audit_remark = #{record.companyAuditRemark},
</if>
<if test="record.examineStatusId == 100 and record.examineStatusId == '100'">
direct_audit_by = #{record.companyAuditBy},
direct_audit_time = now(),
direct_audit_remark = #{record.companyAuditRemark},
</if>
</trim>
WHERE
task_id = #{record.taskId}
</update>
<update id="updateLeaseApplyDetailsAuditInfo">
update
lease_apply_details
@ -636,6 +669,29 @@
parennt_id = #{record.parenntId}
</update>
<update id="updateLeaseApplyDetailsRejectInfo">
update
lease_apply_details
set
<trim suffixOverrides=",">
<if test="record.auditNum != null and record.auditNum != '' ">
audit_num = #{record.auditNum},
</if>
<if test="record.alNum != null and record.alNum != '' ">
al_num = #{record.alNum},
</if>
<if test="record.status!= null and record.status!= '' ">
status = #{record.status},
</if>
<if test="record.updateBy != null and record.updateBy != '' ">
update_by = #{record.updateBy},
</if>
update_time = now()
</trim>
where
parennt_id = #{record.parenntId}
</update>
<update id="updateLeaseInfo">
UPDATE lease_apply_info SET lease_person = #{leasePerson}, phone = #{phone}, remark = #{remark}
WHERE task_id = #{taskId}