退料申请、管理数据权限问题
This commit is contained in:
parent
baa645f36b
commit
d0068ab35d
|
|
@ -266,14 +266,14 @@ public class BackApplyController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("退料审核通过")
|
@ApiOperation("退料审核通过-app")
|
||||||
@Log(title = "退料审核通过", businessType = BusinessType.UPDATE)
|
@Log(title = "退料审核通过", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/audit")
|
@PostMapping("/audit")
|
||||||
public AjaxResult audit(@RequestBody BackApplyInfo record) {
|
public AjaxResult audit(@RequestBody BackApplyInfo record) {
|
||||||
return toAjax(backApplyService.audit(record));
|
return toAjax(backApplyService.audit(record));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("退料审核驳回")
|
@ApiOperation("退料审核驳回-app")
|
||||||
@Log(title = "退料审核驳回", businessType = BusinessType.UPDATE)
|
@Log(title = "退料审核驳回", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/refuse")
|
@PostMapping("/refuse")
|
||||||
public AjaxResult refuse(@RequestBody BackApplyInfo record) {
|
public AjaxResult refuse(@RequestBody BackApplyInfo record) {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ public interface BackApplyAppMapper {
|
||||||
*/
|
*/
|
||||||
List<BmAgreementInfo> getbackUnit(BmAgreementInfo record);
|
List<BmAgreementInfo> getbackUnit(BmAgreementInfo record);
|
||||||
|
|
||||||
|
List<Integer> getTaskIdById(BackApplyInfo bean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询退料工程列表
|
* 查询退料工程列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -38,14 +40,16 @@ public interface BackApplyAppMapper {
|
||||||
int del(BackApplyInfo record);
|
int del(BackApplyInfo record);
|
||||||
|
|
||||||
List<BackApplyInfo> examineList(BackApplyInfo record);
|
List<BackApplyInfo> examineList(BackApplyInfo record);
|
||||||
|
List<BackApplyInfo> examineListByUser(BackApplyInfo record);
|
||||||
|
|
||||||
List<BackApplyInfo> examineView(BackApplyInfo record);
|
List<BackApplyInfo> examineView(BackApplyInfo record);
|
||||||
|
|
||||||
int audit(BackApplyInfo record);
|
int audit(BackApplyInfo record);
|
||||||
int auditByAdmin(BackApplyInfo record);
|
|
||||||
int updateBackApply(BackApplyInfo record);
|
int updateBackApply(BackApplyInfo record);
|
||||||
|
|
||||||
List<BackApplyInfo> selectBackApplyInfo(BackApplyInfo record);
|
List<BackApplyInfo> selectBackApplyInfo(BackApplyInfo record);
|
||||||
|
|
||||||
int refuse(BackApplyInfo record);
|
int refuse(BackApplyInfo record);
|
||||||
|
|
||||||
|
int updateTmTask(BackApplyInfo record);
|
||||||
}
|
}
|
||||||
|
|
@ -79,8 +79,17 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BackApplyInfo> examineList(BackApplyInfo record) {
|
public List<BackApplyInfo> examineList(BackApplyInfo record) {
|
||||||
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
if (roles.contains("admin")) {
|
||||||
|
//管理员可以看到所有退料申请
|
||||||
return backApplyMapper.examineList(record);
|
return backApplyMapper.examineList(record);
|
||||||
}
|
}
|
||||||
|
//个人只能看到自己的申请的退料
|
||||||
|
String username = SecurityUtils.getLoginUser().getUsername();
|
||||||
|
record.setCreateBy(username);
|
||||||
|
return backApplyMapper.examineListByUser(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BackApplyInfo> examineView(BackApplyInfo record) {
|
public List<BackApplyInfo> examineView(BackApplyInfo record) {
|
||||||
|
|
@ -93,37 +102,60 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
String username = SecurityUtils.getLoginUser().getUsername();
|
String username = SecurityUtils.getLoginUser().getUsername();
|
||||||
record.setCreateBy(username);
|
record.setCreateBy(username);
|
||||||
if (roles.contains("admin")){
|
if (roles.contains("jjfgs") || roles.contains("admin")) {
|
||||||
return backApplyMapper.auditByAdmin(record);
|
|
||||||
}
|
|
||||||
if (roles.contains("jjfgs")) {
|
|
||||||
record.setCompanyId("101");
|
record.setCompanyId("101");
|
||||||
record.setStatus("1");
|
record.setStatus("1");
|
||||||
//可能是taskid(确认一下)
|
|
||||||
return backApplyMapper.audit(record);
|
return backApplyMapper.audit(record);
|
||||||
}
|
}
|
||||||
if (roles.contains("tsfgs")) {
|
if (roles.contains("tsfgs") || roles.contains("admin")) {
|
||||||
record.setCompanyId("102");
|
record.setCompanyId("102");
|
||||||
record.setStatus("3");
|
record.setStatus("3");
|
||||||
return backApplyMapper.audit(record);
|
return backApplyMapper.audit(record);
|
||||||
}
|
}
|
||||||
List<BackApplyInfo> backApplyInfos = backApplyMapper.selectBackApplyInfo(record);
|
List<Integer> taskIdById = backApplyMapper.getTaskIdById(record);
|
||||||
if (CollUtil.isNotEmpty(backApplyInfos)) {
|
if (CollUtil.isNotEmpty(taskIdById)) {
|
||||||
for (BackApplyInfo backApplyInfo : backApplyInfos) {
|
for (Integer taskId : taskIdById) {
|
||||||
if (backApplyInfo.getStatus().equals("1") || backApplyInfo.getStatus().equals("3")) {
|
if (taskId == 1 || taskId == 3) {
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (num == backApplyInfos.size()) {
|
if (num == taskIdById.size()) {
|
||||||
return backApplyMapper.updateBackApply(record);
|
record.setTaskStatus("38");
|
||||||
|
backApplyMapper.updateTmTask(record);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int refuse(BackApplyInfo record) {
|
public int refuse(BackApplyInfo record) {
|
||||||
|
int num = 0;
|
||||||
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
String username = SecurityUtils.getLoginUser().getUsername();
|
||||||
|
record.setCreateBy(username);
|
||||||
|
if (roles.contains("jjfgs") || roles.contains("admin")) {
|
||||||
|
record.setCompanyId("101");
|
||||||
|
record.setStatus("2");
|
||||||
return backApplyMapper.refuse(record);
|
return backApplyMapper.refuse(record);
|
||||||
}
|
}
|
||||||
|
if (roles.contains("tsfgs") || roles.contains("admin")) {
|
||||||
|
record.setCompanyId("102");
|
||||||
|
record.setStatus("4");
|
||||||
|
return backApplyMapper.refuse(record);
|
||||||
|
}
|
||||||
|
List<Integer> taskIdById = backApplyMapper.getTaskIdById(record);
|
||||||
|
if (CollUtil.isNotEmpty(taskIdById)) {
|
||||||
|
for (Integer taskId : taskIdById) {
|
||||||
|
if (taskId == 2 || taskId == 4) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num == taskIdById.size()) {
|
||||||
|
record.setTaskStatus("101");
|
||||||
|
backApplyMapper.updateTmTask(record);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -283,25 +283,43 @@
|
||||||
bai.id = #{id} and bai.company_id = #{companyId}
|
bai.id = #{id} and bai.company_id = #{companyId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<update id="refuse">
|
<update id="refuse">
|
||||||
UPDATE tm_task tt
|
UPDATE tm_task tt
|
||||||
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
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
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
||||||
<if test="taskStatus == 108">
|
SET bai.status = #{status},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.direct_audit_time=NOW()
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='6',bai.direct_audit_time=NOW()
|
|
||||||
</if>
|
|
||||||
<if test="taskStatus == 110">
|
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='8',bai.direct_audit_time=NOW()
|
|
||||||
</if>
|
|
||||||
<if test="taskStatus == 104">
|
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='2',bai.direct_audit_time=NOW()
|
|
||||||
</if>
|
|
||||||
<if test="taskStatus == 106">
|
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='4',bai.direct_audit_time=NOW()
|
|
||||||
</if>
|
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id} and bai.company_id = #{companyId}
|
||||||
|
</update>
|
||||||
|
<update id="examineListByUser">
|
||||||
|
SELECT
|
||||||
|
bai.id,
|
||||||
|
bai.back_person as backPerson,
|
||||||
|
bai.phone,
|
||||||
|
bpl.lot_name as lotName,
|
||||||
|
bui.unit_name as unitName,
|
||||||
|
bai.back_time as backTime,
|
||||||
|
bagi.plan_start_time as planStartTime,
|
||||||
|
tt.task_status as taskStatus,
|
||||||
|
GROUP_CONCAT(DISTINCT bad.type_id) as typeId,
|
||||||
|
GROUP_CONCAT(CONCAT_WS('/', IFNULL(mt2.type_name, ''))) AS typeName,
|
||||||
|
SUM(DISTINCT bad.pre_num) AS num,
|
||||||
|
bai.direct_audit_remark as directAuditRemark
|
||||||
|
FROM
|
||||||
|
back_apply_info bai
|
||||||
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
||||||
|
LEFT JOIN tm_task tt on tt.task_id=bai.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta on tta.task_id=tt.task_id
|
||||||
|
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 ma_type mt1 ON mt1.type_id=bad.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id=mt1.parent_id
|
||||||
|
WHERE
|
||||||
|
bad.type_id is not null and tt.create_by = #{createBy}
|
||||||
|
GROUP BY bai.id, us.user_name, bai.phone, bpl.lot_name, bui.unit_name, bagi.plan_start_time
|
||||||
|
ORDER BY bai.create_time desc
|
||||||
</update>
|
</update>
|
||||||
<update id="updateBackApply">
|
<update id="updateBackApply">
|
||||||
UPDATE tm_task tt
|
UPDATE tm_task tt
|
||||||
|
|
@ -311,11 +329,10 @@
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id}
|
||||||
</update>
|
</update>
|
||||||
<update id="auditByAdmin">
|
<update id="updateTmTask">
|
||||||
UPDATE tm_task tt
|
UPDATE tm_task tt
|
||||||
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
INNER 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 = #{taskStatus}
|
||||||
SET bai.status = 38,bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.direct_audit_time=NOW()
|
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -512,6 +529,12 @@
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getTaskIdById" 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>
|
</mapper>
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.bonus.sgzb.material.controller;
|
package com.bonus.sgzb.material.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.bonus.sgzb.common.core.utils.ListPagingUtil;
|
||||||
|
import com.bonus.sgzb.common.core.utils.ServletUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||||
|
|
@ -8,7 +11,9 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.sgzb.common.log.annotation.Log;
|
import com.bonus.sgzb.common.log.annotation.Log;
|
||||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
|
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||||
import com.bonus.sgzb.material.service.BackApplyService;
|
import com.bonus.sgzb.material.service.BackApplyService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
@ -17,6 +22,10 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_NUM;
|
||||||
|
import static com.bonus.sgzb.common.core.web.page.TableSupport.PAGE_SIZE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hay
|
* @author hay
|
||||||
|
|
@ -44,9 +53,10 @@ public class BackApplyController extends BaseController {
|
||||||
@ApiOperation(value = "获取退料审核列表-web")
|
@ApiOperation(value = "获取退料审核列表-web")
|
||||||
@GetMapping("/getBackAuditList")
|
@GetMapping("/getBackAuditList")
|
||||||
public AjaxResult getBackAuditList(BackApplyInfo bean) {
|
public AjaxResult getBackAuditList(BackApplyInfo bean) {
|
||||||
startPage();
|
|
||||||
List<BackApplyInfo> list = backApplyService.getBackAuditList(bean);
|
List<BackApplyInfo> list = backApplyService.getBackAuditList(bean);
|
||||||
return AjaxResult.success(getDataTable(list));
|
Integer pageIndex = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
||||||
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
||||||
|
return AjaxResult.success(ListPagingUtil.paging(pageIndex,pageSize, list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -195,8 +205,8 @@ public class BackApplyController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("退料审核-审核")
|
@ApiOperation("退料审核-审核(web)")
|
||||||
@Log(title = "退料审核列表-审核", businessType = BusinessType.UPDATE)
|
@Log(title = "退料审核列表-审核(web)", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/audit")
|
@PostMapping("/audit")
|
||||||
public AjaxResult audit(@RequestBody BackApplyInfo record) {
|
public AjaxResult audit(@RequestBody BackApplyInfo record) {
|
||||||
return backApplyService.audit(record);
|
return backApplyService.audit(record);
|
||||||
|
|
@ -217,7 +227,7 @@ public class BackApplyController extends BaseController {
|
||||||
@Log(title = "退料申请导出", businessType = BusinessType.EXPORT)
|
@Log(title = "退料申请导出", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BackApplyInfo bean) {
|
public void export(HttpServletResponse response, BackApplyInfo bean) {
|
||||||
List<BackApplyInfo> list = backApplyService.exportList(bean);
|
List<BackApplyInfo> list = backApplyService.getBackApplyList(bean);
|
||||||
ExcelUtil<BackApplyInfo> util = new ExcelUtil<BackApplyInfo>(BackApplyInfo.class);
|
ExcelUtil<BackApplyInfo> util = new ExcelUtil<BackApplyInfo>(BackApplyInfo.class);
|
||||||
util.exportExcel(response, list, "退料申请数据");
|
util.exportExcel(response, list, "退料申请数据");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ public class BackApplyInfo extends BaseEntity {
|
||||||
@ApiModelProperty(value = "任务ID")
|
@ApiModelProperty(value = "任务ID")
|
||||||
private Integer taskId;
|
private Integer taskId;
|
||||||
|
|
||||||
|
/** 任务ID */
|
||||||
|
@ApiModelProperty(value = "任务ID")
|
||||||
|
private String taskIds;
|
||||||
|
|
||||||
/** 任务ID */
|
/** 任务ID */
|
||||||
@ApiModelProperty(value = "任务类型")
|
@ApiModelProperty(value = "任务类型")
|
||||||
private Integer taskType;
|
private Integer taskType;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
|
import com.bonus.sgzb.material.domain.TmTask;
|
||||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -88,6 +89,8 @@ public interface BackApplyMapper {
|
||||||
*/
|
*/
|
||||||
int del(BackApplyInfo bean);
|
int del(BackApplyInfo bean);
|
||||||
|
|
||||||
|
|
||||||
|
List<Integer> getTaskIdById(BackApplyInfo bean);
|
||||||
/**
|
/**
|
||||||
* 通过
|
* 通过
|
||||||
* @param bean
|
* @param bean
|
||||||
|
|
@ -95,6 +98,10 @@ public interface BackApplyMapper {
|
||||||
*/
|
*/
|
||||||
int audit(BackApplyInfo bean);
|
int audit(BackApplyInfo bean);
|
||||||
|
|
||||||
|
int updateTmTask(BackApplyInfo bean);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驳回
|
* 驳回
|
||||||
* @param bean
|
* @param bean
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
package com.bonus.sgzb.material.service.impl;
|
package com.bonus.sgzb.material.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
import com.bonus.sgzb.material.domain.BackApplyInfo;
|
||||||
|
import com.bonus.sgzb.material.domain.TmTask;
|
||||||
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
import com.bonus.sgzb.material.domain.TypeTreeNode;
|
||||||
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
import com.bonus.sgzb.material.mapper.BackApplyMapper;
|
||||||
|
import com.bonus.sgzb.material.mapper.TaskMapper;
|
||||||
import com.bonus.sgzb.material.service.BackApplyService;
|
import com.bonus.sgzb.material.service.BackApplyService;
|
||||||
import com.bonus.sgzb.material.vo.GlobalContants;
|
import com.bonus.sgzb.material.vo.GlobalContants;
|
||||||
import com.bonus.sgzb.material.vo.TypeTreeBuild;
|
import com.bonus.sgzb.material.vo.TypeTreeBuild;
|
||||||
|
|
@ -30,6 +33,9 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BackApplyMapper backApplyMapper;
|
private BackApplyMapper backApplyMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskMapper tmTaskMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BackApplyInfo> getBackApplyList(BackApplyInfo bean) {
|
public List<BackApplyInfo> getBackApplyList(BackApplyInfo bean) {
|
||||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
|
@ -50,21 +56,25 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
//管理员可以看到所有退料申请
|
//管理员可以看到所有退料申请
|
||||||
return backApplyMapper.getBackApplyListByAdmin(bean);
|
return backApplyMapper.getBackApplyListByAdmin(bean);
|
||||||
}
|
}
|
||||||
//机具分公司只能看到机具公司的退料
|
List<BackApplyInfo> backApplyInfos = new ArrayList<>();
|
||||||
if (roles.contains("jjfgs")){
|
|
||||||
List<BackApplyInfo> backApplyListByAdmin = backApplyMapper.getBackApplyListByAdmin(bean);
|
List<BackApplyInfo> backApplyListByAdmin = backApplyMapper.getBackApplyListByAdmin(bean);
|
||||||
|
//机具分公司只能看到机具公司的退料
|
||||||
|
if (CollUtil.isNotEmpty(backApplyListByAdmin) && roles.contains("sgb")) {
|
||||||
for (BackApplyInfo backApplyInfo : backApplyListByAdmin) {
|
for (BackApplyInfo backApplyInfo : backApplyListByAdmin) {
|
||||||
if (StringUtils.hasText(backApplyInfo.getCompanyId())){
|
if (StringUtils.hasText(backApplyInfo.getCompanyId()) && backApplyInfo.getCompanyId().contains("101")) {
|
||||||
|
backApplyInfos.add(backApplyInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return backApplyListByAdmin;
|
|
||||||
}
|
}
|
||||||
//调试分公司只能看到调试公司的退料
|
//调试分公司只能看到调试公司的退料
|
||||||
if (roles.contains("tsfgs")){
|
if (CollUtil.isNotEmpty(backApplyListByAdmin) && roles.contains("ajb")) {
|
||||||
|
for (BackApplyInfo backApplyInfo : backApplyListByAdmin) {
|
||||||
|
if (StringUtils.hasText(backApplyInfo.getCompanyId()) && backApplyInfo.getCompanyId().contains("102")) {
|
||||||
|
backApplyInfos.add(backApplyInfo);
|
||||||
}
|
}
|
||||||
return backApplyMapper.getBackApplyList(bean);
|
}
|
||||||
|
}
|
||||||
|
return backApplyInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -145,16 +155,45 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult audit(BackApplyInfo bean) {
|
public AjaxResult audit(BackApplyInfo bean) {
|
||||||
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
String username = SecurityUtils.getLoginUser().getUsername();
|
||||||
|
int num = 0;
|
||||||
if (!StringUtils.isEmpty(bean.getIds())) {
|
if (!StringUtils.isEmpty(bean.getIds())) {
|
||||||
String[] ids = bean.getIds().split(",");
|
String[] ids = bean.getIds().split(",");
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
String id = ids[i];
|
String id = ids[i];
|
||||||
bean.setId(Long.valueOf(id));
|
bean.setId(Long.valueOf(id));
|
||||||
|
if (roles.contains("jjfgs") || roles.contains("admin")) {
|
||||||
|
bean.setCompanyId("101");
|
||||||
|
bean.setCreateBy(username);
|
||||||
|
bean.setStatus("1");
|
||||||
int re = backApplyMapper.audit(bean);
|
int re = backApplyMapper.audit(bean);
|
||||||
if (re < 1) {
|
if (re < 1) {
|
||||||
return AjaxResult.error("审核失败");
|
return AjaxResult.error("审核失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (roles.contains("tsfgs") || roles.contains("admin")) {
|
||||||
|
bean.setCompanyId("102");
|
||||||
|
bean.setCreateBy(username);
|
||||||
|
bean.setStatus("2");
|
||||||
|
int re = backApplyMapper.audit(bean);
|
||||||
|
if (re < 1) {
|
||||||
|
return AjaxResult.error("审核失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Integer> taskIdById = backApplyMapper.getTaskIdById(bean);
|
||||||
|
if (CollUtil.isNotEmpty(taskIdById)) {
|
||||||
|
for (Integer taskId : taskIdById) {
|
||||||
|
if (taskId == 1 || taskId == 3) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num == taskIdById.size()) {
|
||||||
|
bean.setTaskStatus("38");
|
||||||
|
backApplyMapper.updateTmTask(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
return AjaxResult.success("审核成功");
|
return AjaxResult.success("审核成功");
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("审核失败,未获取到参数");
|
return AjaxResult.error("审核失败,未获取到参数");
|
||||||
|
|
@ -163,16 +202,45 @@ public class BackApplyServiceImpl implements BackApplyService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult refuse(BackApplyInfo bean) {
|
public AjaxResult refuse(BackApplyInfo bean) {
|
||||||
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
String username = SecurityUtils.getLoginUser().getUsername();
|
||||||
|
int num = 0;
|
||||||
if (!StringUtils.isEmpty(bean.getIds())) {
|
if (!StringUtils.isEmpty(bean.getIds())) {
|
||||||
String[] ids = bean.getIds().split(",");
|
String[] ids = bean.getIds().split(",");
|
||||||
for (int i = 0; i < ids.length; i++) {
|
for (int i = 0; i < ids.length; i++) {
|
||||||
String id = ids[i];
|
String id = ids[i];
|
||||||
bean.setId(Long.valueOf(id));
|
bean.setId(Long.valueOf(id));
|
||||||
|
if (roles.contains("jjfgs") || roles.contains("admin")) {
|
||||||
|
bean.setCompanyId("101");
|
||||||
|
bean.setCreateBy(username);
|
||||||
|
bean.setStatus("2");
|
||||||
int re = backApplyMapper.refuse(bean);
|
int re = backApplyMapper.refuse(bean);
|
||||||
if (re < 1) {
|
if (re < 1) {
|
||||||
return AjaxResult.error("驳回失败");
|
return AjaxResult.error("驳回失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (roles.contains("tsfgs") || roles.contains("admin")) {
|
||||||
|
bean.setCompanyId("102");
|
||||||
|
bean.setCreateBy(username);
|
||||||
|
bean.setStatus("4");
|
||||||
|
int re = backApplyMapper.refuse(bean);
|
||||||
|
if (re < 1) {
|
||||||
|
return AjaxResult.error("驳回失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Integer> taskIdById = backApplyMapper.getTaskIdById(bean);
|
||||||
|
if (CollUtil.isNotEmpty(taskIdById)) {
|
||||||
|
for (Integer taskId : taskIdById) {
|
||||||
|
if (taskId == 2 || taskId == 4) {
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num == taskIdById.size()) {
|
||||||
|
bean.setTaskStatus("101");
|
||||||
|
backApplyMapper.updateTmTask(bean);
|
||||||
|
}
|
||||||
|
}
|
||||||
return AjaxResult.success("驳回成功");
|
return AjaxResult.success("驳回成功");
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("驳回失败,未获取到参数");
|
return AjaxResult.error("驳回失败,未获取到参数");
|
||||||
|
|
|
||||||
|
|
@ -253,27 +253,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
UPDATE tm_task tt
|
UPDATE tm_task tt
|
||||||
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
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
|
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},bad.status='1',bai.direct_audit_time=NOW()
|
SET bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bad.status=#{status},bai.direct_audit_time=NOW()
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id}
|
||||||
|
<if test="companyId != null and companyId != ''">
|
||||||
|
and bai.company_id = #{companyId},
|
||||||
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="refuse">
|
<update id="refuse">
|
||||||
UPDATE tm_task tt
|
UPDATE tm_task tt
|
||||||
LEFT JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
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
|
LEFT JOIN back_apply_details bad on bad.parent_id=bai.id
|
||||||
<if test="taskStatus == 108">
|
SET bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bad.status=#{status},bai.direct_audit_time=NOW()
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='6',bai.direct_audit_time=NOW()
|
WHERE
|
||||||
</if>
|
bai.id = #{id}
|
||||||
<if test="taskStatus == 110">
|
<if test="companyId != null and companyId != ''">
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='8',bai.direct_audit_time=NOW()
|
and bai.company_id = #{companyId},
|
||||||
</if>
|
|
||||||
<if test="taskStatus == 104">
|
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='2',bai.direct_audit_time=NOW()
|
|
||||||
</if>
|
|
||||||
<if test="taskStatus == 106">
|
|
||||||
SET tt.task_status = #{taskStatus},bad.audit_num=bad.pre_num,bai.direct_audit_by=#{createBy},bai.status='4',bai.direct_audit_time=NOW()
|
|
||||||
</if>
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateTmTask">
|
||||||
|
UPDATE tm_task tt
|
||||||
|
INNER JOIN back_apply_info bai ON bai.task_id = tt.task_id
|
||||||
|
SET tt.task_status = #{taskStatus}
|
||||||
WHERE
|
WHERE
|
||||||
bai.id = #{id}
|
bai.id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
@ -640,4 +642,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ORDER BY bai.create_time desc
|
ORDER BY bai.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTaskIdById" 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>
|
</mapper>
|
||||||
Loading…
Reference in New Issue