后台-退料申请与审核
This commit is contained in:
parent
5c50ce4706
commit
a428cf7658
|
|
@ -85,7 +85,7 @@ public class BackApplyController extends BaseController {
|
|||
|
||||
|
||||
@Log(title = "领料申请提交", businessType = BusinessType.INSERT)
|
||||
@PostMapping("submitBackApply")
|
||||
@PostMapping("/submitBackApply")
|
||||
public AjaxResult submitBackApply(@RequestBody BackApplyInfo bean) {
|
||||
if (StringUtils.isNull(bean)) {
|
||||
return AjaxResult.error("参数错误");
|
||||
|
|
@ -97,6 +97,8 @@ public class BackApplyController extends BaseController {
|
|||
return AjaxResult.error("后台退料编号生成异常,请重试!");
|
||||
}
|
||||
bean.setCode(code);
|
||||
bean.setTaskType(36);
|
||||
bean.setTaskStatus("37");
|
||||
// 创建任务
|
||||
boolean addTaskResult = backApplyService.insertSelective(bean) > 0;
|
||||
if (addTaskResult && bean.getTaskId() != null) {
|
||||
|
|
@ -137,4 +139,15 @@ public class BackApplyController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("退料审核-审核")
|
||||
@Log(title = "退料审核列表-审核", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/audit")
|
||||
public AjaxResult audit(@RequestBody BackApplyInfo record)
|
||||
{
|
||||
return backApplyService.audit(record);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ public class BackApplyInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "退料ID")
|
||||
private Long id;
|
||||
|
||||
/** 退料ID-字符串 */
|
||||
@ApiModelProperty(value = "退料ID-字符串")
|
||||
private String ids;
|
||||
|
||||
/** 退料单号 */
|
||||
@Excel(name = "退料单号")
|
||||
@ApiModelProperty(value = "退料单号")
|
||||
|
|
@ -30,8 +34,11 @@ public class BackApplyInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "任务ID")
|
||||
private Integer taskId;
|
||||
|
||||
/** 任务ID */
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private Integer taskType;
|
||||
|
||||
/** 签订日期 */
|
||||
@Excel(name = "签订日期")
|
||||
@ApiModelProperty(value = "签订日期")
|
||||
private String signTime;
|
||||
|
||||
|
|
@ -41,7 +48,7 @@ public class BackApplyInfo extends BaseEntity {
|
|||
private String backPerson;
|
||||
|
||||
/** 联系电话 */
|
||||
@Excel(name = "联系电话")
|
||||
@Excel(name = "退料人联系电话")
|
||||
@ApiModelProperty(value = "联系电话")
|
||||
private String phone;
|
||||
|
||||
|
|
@ -88,21 +95,64 @@ public class BackApplyInfo extends BaseEntity {
|
|||
@ApiModelProperty(value = "工程id")
|
||||
private Integer lotId;
|
||||
|
||||
@Excel(name = "退料工程名称")
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String lotName;
|
||||
|
||||
@ApiModelProperty(value = "单位id")
|
||||
private Integer unitId;
|
||||
|
||||
@Excel(name = "退料单位名称")
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
@Excel(name = "退料申请时间")
|
||||
@ApiModelProperty(value = "退料日期")
|
||||
private String backTime;
|
||||
|
||||
@Excel(name = "协议号")
|
||||
@ApiModelProperty(value = "协议编号")
|
||||
private String agreementCode;
|
||||
|
||||
@Excel(name = "退料状态")
|
||||
@ApiModelProperty(value = "任务状态")
|
||||
private String taskStatus;
|
||||
|
||||
@ApiModelProperty(value = "协议id")
|
||||
private Integer agreementId;
|
||||
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String typeId;
|
||||
|
||||
@Excel(name = "退料工机具类型")
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格编号")
|
||||
private String typeCode;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
private String num;
|
||||
private String typeByNum;
|
||||
|
||||
@ApiModelProperty(value = "详情id和数量")
|
||||
private String detailsIdByNum;
|
||||
|
||||
@ApiModelProperty(value = "类型id和数量")
|
||||
private String typeIdByNum;
|
||||
|
||||
@ApiModelProperty(value = "详情id")
|
||||
private String detailsId;
|
||||
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value = "在用数量")
|
||||
private String useNum;
|
||||
|
||||
@ApiModelProperty(value = "操作人")
|
||||
private String createName;
|
||||
|
||||
@ApiModelProperty(value = "审核人")
|
||||
private String examineName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ public interface BackApplyMapper {
|
|||
|
||||
List<BackApplyInfo> getView(BackApplyInfo bean);
|
||||
|
||||
int setModify(@Param("detailsId") int detailsId, @Param("num") int num);
|
||||
int setModify(@Param("detailsId") String detailsId, @Param("num") String num);
|
||||
|
||||
int del(BackApplyInfo bean);
|
||||
|
||||
int audit(BackApplyInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,6 @@ public interface BackApplyService {
|
|||
AjaxResult setModify(BackApplyInfo bean);
|
||||
|
||||
AjaxResult del(BackApplyInfo bean);
|
||||
|
||||
AjaxResult audit(BackApplyInfo record);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
package com.bonus.sgzb.material.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
||||
import com.bonus.sgzb.material.service.AgreementInfoService;
|
||||
import com.bonus.sgzb.material.service.BackApplyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -82,21 +77,16 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
|
||||
@Override
|
||||
public AjaxResult setModify(BackApplyInfo bean) {
|
||||
if (!StringUtils.isEmpty(bean.getTypeByNum())){
|
||||
// 使用 parseArray 方法解析 JSON 字符串为 JSONArray 对象
|
||||
JSONArray jsonArray = JSON.parseArray(bean.getTypeByNum());
|
||||
// 遍历 JSONArray
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
// 获取当前 JSONObject
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
// 获取 JSONObject 中的属性值
|
||||
int detailsId = jsonObject.getIntValue("detailsId");
|
||||
int num = jsonObject.getIntValue("num");
|
||||
int res=backApplyMapper.setModify(detailsId,num);
|
||||
if (res<1){
|
||||
if (!StringUtils.isEmpty(bean.getDetailsId()) && !StringUtils.isEmpty(bean.getNum())){
|
||||
String[] detailsId = bean.getDetailsId().split(",");
|
||||
String[] num = bean.getNum().split(",");
|
||||
for (int i=0;i< detailsId.length;i++){
|
||||
String detailsIds=detailsId[i];
|
||||
String nums=num[i];
|
||||
int re =backApplyMapper.setModify(detailsIds,nums);
|
||||
if (re<1){
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
}else {
|
||||
|
|
@ -114,4 +104,22 @@ public class BackApplyServiceImpl implements BackApplyService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult audit(BackApplyInfo bean) {
|
||||
if (!StringUtils.isEmpty(bean.getIds())){
|
||||
String[] ids = bean.getDetailsId().split(",");
|
||||
for (int i=0;i< ids.length;i++){
|
||||
String id=ids[i];
|
||||
bean.setId(Long.valueOf(id));
|
||||
int re =backApplyMapper.audit(bean);
|
||||
if (re<1){
|
||||
return AjaxResult.error("审核失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("审核成功");
|
||||
}else {
|
||||
return AjaxResult.error("审核失败,未获取到参数");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,59 +26,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="fileUrl" column="file_url"/>
|
||||
</resultMap>
|
||||
<insert id="insertTask" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.material.domain.BackApplyInfo" useGeneratedKeys="true">
|
||||
insert into tm_task
|
||||
(
|
||||
<if test="taskType != null">
|
||||
task_type,
|
||||
</if>
|
||||
<if test="taskStatus != null">
|
||||
task_status,
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
code,
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark,
|
||||
</if>
|
||||
<if test="companyId != null">
|
||||
company_id,
|
||||
</if>
|
||||
insert into tm_task (
|
||||
<if test="taskType != null">task_type, </if>
|
||||
<if test="taskStatus != null">task_status, </if>
|
||||
<if test="code != null and code != ''">code, </if>
|
||||
<if test="createBy != null and createBy != ''">create_by, </if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by, </if>
|
||||
<if test="updateTime != null">update_time, </if>
|
||||
<if test="remark != null and remark != ''">remark, </if>
|
||||
<if test="companyId != null">company_id, </if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="taskType != null">
|
||||
#{taskType},
|
||||
</if>
|
||||
<if test="taskStatus != null">
|
||||
#{taskStatus},
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
#{code},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="companyId != null">
|
||||
#{companyId},
|
||||
</if>
|
||||
<if test="taskType != null">#{taskType}, </if>
|
||||
<if test="taskStatus != null">#{taskStatus}, </if>
|
||||
<if test="code != null and code != ''">#{code}, </if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy}, </if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy}, </if>
|
||||
<if test="updateTime != null">#{updateTime}, </if>
|
||||
<if test="remark != null and remark != ''">#{remark}, </if>
|
||||
<if test="companyId != null">#{companyId}, </if>
|
||||
NOW()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertTaskAgreement">
|
||||
|
|
@ -280,24 +248,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
set pre_num =#{num}
|
||||
where id = #{detailsId}
|
||||
</update>
|
||||
|
||||
<update id="audit">
|
||||
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 tt.task_status = '38',bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.direct_audit_time=NOW()
|
||||
WHERE
|
||||
bai.id = #{id}
|
||||
</update>
|
||||
<delete id="del">
|
||||
DELETE
|
||||
FROM tm_task_agreement tta LEFT JOIN back_apply_info bai
|
||||
ON bai.task_id = tta.task_id
|
||||
WHERE
|
||||
bai.id = #{id};
|
||||
FROM tm_task_agreement
|
||||
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
||||
|
||||
DELETE
|
||||
FROM tm_task tt LEFT JOIN back_apply_info bai
|
||||
ON bai.task_id = tt.task_id
|
||||
WHERE
|
||||
bai.id = #{id};
|
||||
FROM tm_task
|
||||
WHERE task_id IN (SELECT task_id FROM back_apply_info WHERE id = #{id});
|
||||
|
||||
|
||||
DELETE
|
||||
FROM back_apply_details bad LEFT JOIN back_apply_info bai
|
||||
ON bai.id = bad.parent_id
|
||||
WHERE
|
||||
bai.id = #{id};
|
||||
FROM back_apply_details
|
||||
WHERE parent_id IN (SELECT id FROM back_apply_info WHERE id = #{id});
|
||||
|
||||
DELETE
|
||||
FROM back_apply_info
|
||||
|
|
@ -340,6 +312,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and bai.back_person like concat('%', #{keyWord}, '%') or
|
||||
and bai.phone like concat('%', #{keyWord}, '%')
|
||||
</if>
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bui.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="lotId != null and lotId != ''">
|
||||
and bpl.lot_id = #{lotId}
|
||||
</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">
|
||||
and tt.task_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="agreementCode != null and agreementCode != ''">
|
||||
and bagi.agreement_code like concat('%', #{agreementCode}, '%')
|
||||
</if>
|
||||
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
||||
</select>
|
||||
|
||||
|
|
@ -368,6 +352,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_machine mm on mm.ma_id = lod.ma_id
|
||||
WHERE tta.agreement_id = #{agreementId}
|
||||
and tt.task_type = '29'
|
||||
and mt.type_id is not null
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and mt.type_name like concat('%', #{keyWord}, '%') or
|
||||
and mt3.type_name like concat('%', #{keyWord}, '%') or
|
||||
and mm.ma_code like concat('%', #{keyWord}, '%')
|
||||
</if>
|
||||
) AS subquery1
|
||||
LEFT JOIN
|
||||
(
|
||||
|
|
@ -387,6 +377,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
WHERE tta.agreement_id = #{agreementId}
|
||||
and tt.task_type = '36'
|
||||
and mt.type_id is not null
|
||||
) AS subquery2
|
||||
ON subquery1.type_id = subquery2.type_id
|
||||
</select>
|
||||
|
|
@ -408,6 +399,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bagi.agreement_code as agreementCode,
|
||||
bai.back_person as backPerson,
|
||||
bai.phone,
|
||||
bai.back_time as backTime,
|
||||
bai.`code`,
|
||||
bai.remark,
|
||||
us.user_name as createName,
|
||||
us2.user_name as examineName,
|
||||
bad.type_id as typeId,
|
||||
mt.type_name typeCode,
|
||||
CONCAT_WS(
|
||||
|
|
@ -428,8 +424,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
||||
LEFT JOIN bm_project_lot bpl ON bpl.lot_id = bagi.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bagi.unit_id
|
||||
LEFT JOIN sys_user us on us.user_id=bai.create_by
|
||||
LEFT JOIN sys_user us2 on us2.user_id=bai.direct_audit_by
|
||||
WHERE
|
||||
bai.id = #{id}
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and mt.type_name like concat('%', #{keyWord}, '%') or
|
||||
and mt3.type_name like concat('%', #{keyWord}, '%') or
|
||||
and mm.ma_code like concat('%', #{keyWord}, '%')
|
||||
</if>
|
||||
) AS result1
|
||||
LEFT JOIN
|
||||
(
|
||||
|
|
@ -453,6 +456,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
tta.agreement_id = #{agreementId}
|
||||
AND tt.task_type = '29'
|
||||
and mt.type_id is not null
|
||||
) AS subquery1
|
||||
LEFT JOIN (-- 第二个查询作为子查询
|
||||
SELECT
|
||||
|
|
@ -468,8 +472,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
tta.agreement_id = #{agreementId}
|
||||
AND tt.task_type = '36'
|
||||
and mt.type_id is not null
|
||||
) AS subquery2 ON subquery1.type_id = subquery2.type_id
|
||||
) AS result2 ON result1.typeId = result2.typeId;
|
||||
) AS result2 ON result1.typeId = result2.typeId
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue