bug
This commit is contained in:
parent
546eb704fb
commit
a10c3dd8a7
|
|
@ -13,6 +13,7 @@ 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.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.domain.BackApplyDto;
|
||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.material.service.BackApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -432,6 +433,14 @@ public class BackApplyController extends BaseController {
|
|||
return backApplyService.audit(record);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("退料批量审核-审核(web)")
|
||||
@Log(title = "退料批量审核-审核(web)", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/auditAll")
|
||||
public AjaxResult auditAll(@RequestBody BackApplyDto dto) {
|
||||
return backApplyService.auditAll(dto);
|
||||
}
|
||||
|
||||
@ApiOperation("退料审核-驳回(web)")
|
||||
@Log(title = "退料审核列表-驳回(web)", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/refuse")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退料批量审核dto
|
||||
* @Author ma_sh
|
||||
* @create 2024/4/20 17:03
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BackApplyDto {
|
||||
|
||||
/** 退料ID */
|
||||
@ApiModelProperty(value = "退料ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value="同一退料单中不同器具状态")
|
||||
private String status;
|
||||
|
||||
private String auditNum;
|
||||
|
||||
/** 创建者 */
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private String createBy;
|
||||
|
||||
/** 数据所属组织 */
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private String companyId;
|
||||
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private String taskStatus;
|
||||
|
||||
|
||||
|
||||
private List<BackApplyListDto> backApplyList;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退料批量审核list dto
|
||||
* @Author ma_sh
|
||||
* @create 2024/4/20 17:04
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BackApplyListDto {
|
||||
|
||||
/** 退料ID */
|
||||
@ApiModelProperty(value = "退料ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 退料任务实体集合
|
||||
*/
|
||||
@ApiModelProperty(value="退料任务实体集合")
|
||||
private List<BackApplyInfo> backApplyDetails;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.material.mapper;
|
||||
|
||||
import com.bonus.sgzb.material.domain.BackApplyDto;
|
||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -139,4 +140,10 @@ public interface BackApplyMapper {
|
|||
int getLeaseOutNum(String typeId);
|
||||
|
||||
int getbackCheckNum(String typeId);
|
||||
|
||||
int auditAll(BackApplyDto dto);
|
||||
|
||||
List<Integer> getTaskIdByIdAll(BackApplyDto dto);
|
||||
|
||||
void updateTmTaskAll(BackApplyDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.material.service;
|
||||
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.BackApplyDto;
|
||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -121,4 +122,11 @@ public interface BackApplyService {
|
|||
List<BackApplyInfo> selectIdByTaskId(Integer taskId);
|
||||
|
||||
int getUseNumByTypeId(String typeId);
|
||||
|
||||
/**
|
||||
* 退料批量审核-审核(web)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult auditAll(BackApplyDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ import com.bonus.sgzb.common.core.utils.StringHelper;
|
|||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.material.domain.MachinePart;
|
||||
import com.bonus.sgzb.material.domain.TmTask;
|
||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||
import com.bonus.sgzb.material.domain.*;
|
||||
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
||||
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||
import com.bonus.sgzb.material.service.BackApplyService;
|
||||
|
|
@ -137,9 +134,11 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
@Override
|
||||
public List<BackApplyInfo> getView(BackApplyInfo bean) {
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
String badId = bean.getBadId();
|
||||
String[] split = badId.split(",");
|
||||
bean.setSplit(split);
|
||||
if (StringUtils.isNotEmpty(bean.getBadId())) {
|
||||
String badId = bean.getBadId();
|
||||
String[] split = badId.split(",");
|
||||
bean.setSplit(split);
|
||||
}
|
||||
if (companyId != null) {
|
||||
bean.setCompanyId(companyId.toString());
|
||||
List<BackApplyInfo> view = backApplyMapper.getView(bean);
|
||||
|
|
@ -412,4 +411,96 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退料批量审核-审核(web)
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult auditAll(BackApplyDto dto) {
|
||||
Set<String> roles = null;
|
||||
Long userid = null;
|
||||
Long companyId = null;
|
||||
try {
|
||||
roles = SecurityUtils.getLoginUser().getRoles();
|
||||
userid = SecurityUtils.getLoginUser().getUserid();
|
||||
companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
} catch (NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("获取用户信息失败:{}", e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(dto.getBackApplyList())) {
|
||||
for (BackApplyListDto backApplyListDto : dto.getBackApplyList()) {
|
||||
dto.setId(backApplyListDto.getId());
|
||||
if (roles != null && roles.contains("admin")) {
|
||||
if (userid != null) {
|
||||
dto.setCreateBy(userid.toString());
|
||||
}
|
||||
dto.setStatus("1");
|
||||
int i = auditAllDetails(dto);
|
||||
if (i == 0) {
|
||||
return AjaxResult.error("审核失败");
|
||||
}
|
||||
}
|
||||
if (roles != null && roles.contains("jjfgs")) {
|
||||
if (companyId != null) {
|
||||
dto.setCompanyId(companyId.toString());
|
||||
}
|
||||
if (userid != null) {
|
||||
dto.setCreateBy(userid.toString());
|
||||
}
|
||||
dto.setStatus("1");
|
||||
int i = auditAllDetails(dto);
|
||||
if (i == 0) {
|
||||
return AjaxResult.error("审核失败");
|
||||
}
|
||||
}
|
||||
if (roles != null && roles.contains("tsfgs")) {
|
||||
if (companyId != null) {
|
||||
dto.setCompanyId(companyId.toString());
|
||||
}
|
||||
if (userid != null) {
|
||||
dto.setCreateBy(userid.toString());
|
||||
}
|
||||
dto.setStatus("3");
|
||||
int i = auditAllDetails(dto);
|
||||
if (i == 0) {
|
||||
return AjaxResult.error("审核失败");
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
List<Integer> taskIdById = backApplyMapper.getTaskIdByIdAll(dto);
|
||||
if (CollUtil.isNotEmpty(taskIdById)) {
|
||||
for (Integer taskId : taskIdById) {
|
||||
if (taskId == 1 || taskId == 3) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num == taskIdById.size()) {
|
||||
dto.setTaskStatus("38");
|
||||
backApplyMapper.updateTmTaskAll(dto);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("审核成功");
|
||||
} else {
|
||||
return AjaxResult.error("审核失败,未获取到参数");
|
||||
}
|
||||
}
|
||||
|
||||
private int auditAllDetails(BackApplyDto dto) {
|
||||
int re = 0;
|
||||
if (CollUtil.isNotEmpty(dto.getBackApplyList())) {
|
||||
for (BackApplyListDto backApplyListDto : dto.getBackApplyList()) {
|
||||
for (BackApplyInfo backApplyDetail : backApplyListDto.getBackApplyDetails()) {
|
||||
dto.setAuditNum(backApplyDetail.getNum());
|
||||
re = backApplyMapper.auditAll(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -342,6 +342,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
tt.task_id = #{taskId}
|
||||
</update>
|
||||
<update id="auditAll">
|
||||
UPDATE tm_task tt
|
||||
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
||||
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
||||
SET bad.audit_num=#{auditNum},bai.direct_audit_by=#{createBy},bai.status=#{status},bai.direct_audit_time=NOW()
|
||||
WHERE
|
||||
bai.id = #{id}
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and bai.company_id = #{companyId}
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateTmTaskAll">
|
||||
UPDATE tm_task tt
|
||||
INNER JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
||||
SET tt.task_status = #{taskStatus}
|
||||
WHERE
|
||||
bai.id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="del">
|
||||
DELETE
|
||||
|
|
@ -539,10 +557,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
WHERE
|
||||
bai.task_id = #{taskId}
|
||||
<if test="split != null and split.length > 0">
|
||||
and bad.id in
|
||||
<foreach item="split" index="index" collection="split" open="(" separator="," close=")">
|
||||
#{split}
|
||||
</foreach>
|
||||
<foreach item="split" index="index" collection="split" open="(" separator="," close=")">
|
||||
#{split}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="companyId != null and companyId != ''">
|
||||
and bai.company_id = #{companyId}
|
||||
</if>
|
||||
|
|
@ -836,5 +856,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getbackCheckNum" resultType="java.lang.Integer">
|
||||
SELECT IFNULL(sum(bcd.back_num),0) FROM back_check_details bcd WHERE bcd.type_id = #{typeId}
|
||||
</select>
|
||||
<select id="getTaskIdByIdAll" resultType="java.lang.Integer">
|
||||
SELECT bai1.status FROM back_apply_info bai1
|
||||
INNER JOIN
|
||||
(SELECT * FROM back_apply_info bai2 WHERE bai2.id = #{id}) dd
|
||||
on bai1.task_id = dd.task_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue