状态控制常量引入
This commit is contained in:
parent
231c914bea
commit
413b6857d2
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.purchase.controller;
|
||||
import com.bonus.common.core.domain.ResultBean;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
|
|
@ -14,13 +15,17 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.bonus.purchase.utils.Constants.*;
|
||||
|
||||
/**
|
||||
* 新购到货管理(bpm_purchase_info)
|
||||
* @author 阮世耀
|
||||
|
|
@ -39,7 +44,7 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
private BpmTaskService bpmTaskService;
|
||||
|
||||
/**
|
||||
* 分页查询--新购任务列表
|
||||
* 分页查询--新购任务一级列表
|
||||
*/
|
||||
@GetMapping(value = "/list")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||
|
|
@ -50,16 +55,41 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 分页查询---新购任务详情列表
|
||||
* 分页查询---新购任务详情列表--内层
|
||||
*/
|
||||
@GetMapping(value = "/detailsList")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||
public TableDataInfo getDetailsList(PurchaseDto record) {
|
||||
public TableDataInfo getDetailsList(@Valid PurchaseDto record) {
|
||||
startPage();
|
||||
List<PurchaseAcceptVo> list = this.bpmPurchaseInfoService.getDetailsList(record);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出新购任务一级列表
|
||||
*/
|
||||
@PostMapping(value = "/export")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:export")
|
||||
public void export(HttpServletResponse response,@NotEmpty(message = "任务数组不能为空") Integer[] taskArray) {
|
||||
List<PurchaseVo> list = this.bpmPurchaseInfoService.selectMangerListInId(Arrays.asList(taskArray));
|
||||
ExcelUtil<PurchaseVo> util = new ExcelUtil<>(PurchaseVo.class);
|
||||
util.exportExcel(response, list, "新购任务列表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出新购任务设备列表
|
||||
* @param response 响应--导出操作
|
||||
* @param deviceArray 领用详情表ID数组
|
||||
*/
|
||||
@PostMapping(value = "/exportDevices")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:export")
|
||||
public void exportDevices(HttpServletResponse response,@NotEmpty(message = "设备数组不能为空") Integer[] deviceArray) {
|
||||
List<PurchaseAcceptVo> list = this.bpmPurchaseInfoService.getDetailsListInId(Arrays.asList(deviceArray));
|
||||
ExcelUtil<PurchaseAcceptVo> util = new ExcelUtil<>(PurchaseAcceptVo.class);
|
||||
util.exportExcel(response, list, "新购任务设备列表");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ElementPlus级联选择器数据接口--获取设备类型
|
||||
*/
|
||||
|
|
@ -84,11 +114,10 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
*/
|
||||
@PutMapping(value = "/commit")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:edit")
|
||||
public ResultBean<Boolean> commit(@RequestBody @NotEmpty Integer[] taskArray) {
|
||||
public ResultBean<Boolean> commit(@RequestBody @NotEmpty(message = "请求参数不能为空") Integer[] taskArray) {
|
||||
int result = 0;
|
||||
for (Integer taskId : taskArray) {
|
||||
result += this.bpmTaskService.updateStatusById(48, taskId);
|
||||
}
|
||||
result += this.bpmTaskService.updateStatusById(PENDING_CONFIRMATION, Arrays.asList(taskArray));
|
||||
result += this.bpmPurchaseInfoService.updateStatusByTaskId(PENDING_CONFIRMATION_BYTE, Arrays.asList(taskArray));
|
||||
return ResultBean.toIsSuccess(result);
|
||||
}
|
||||
|
||||
|
|
@ -98,11 +127,10 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
*/
|
||||
@PutMapping(value = "/confirm")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:edit")
|
||||
public ResultBean<Boolean> confirm(@RequestBody @NotEmpty Integer[] taskArray) {
|
||||
public ResultBean<Boolean> confirm(@RequestBody @NotEmpty(message = "请求参数不能为空") Integer[] taskArray) {
|
||||
int result = 0;
|
||||
for (Integer taskId : taskArray) {
|
||||
result += this.bpmTaskService.updateStatusById(49, taskId);
|
||||
}
|
||||
result += this.bpmTaskService.updateStatusById(PENDING_NOTIFICATION, Arrays.asList(taskArray));
|
||||
result += this.bpmPurchaseInfoService.updateStatusByTaskId(PENDING_NOTIFICATION_BYTE, Arrays.asList(taskArray));
|
||||
return ResultBean.toIsSuccess(result);
|
||||
}
|
||||
|
||||
|
|
@ -161,6 +189,6 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
@DeleteMapping(value = "/deleteDetails/{id}")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:remove")
|
||||
public ResultBean< Boolean> deleteDetailsById(@PathVariable("id") Integer id) {
|
||||
return ResultBean.toIsSuccess(this.bpmPurchaseInfoService.deleteByPrimaryKey(id));
|
||||
return ResultBean.toIsSuccess(this.bpmPurchaseInfoService.updateIsActiveById(id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.purchase.dto;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -41,6 +42,7 @@ public class PurchaseDto {
|
|||
private List<Integer> taskIds;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
@NotNull(message = "查询详情任务id不能为空")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "二级明细id")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.purchase.mapper;
|
||||
import java.util.Collection;
|
||||
import com.bonus.base.api.domain.MaType;
|
||||
import com.bonus.purchase.dto.PurchaseDto;
|
||||
import com.bonus.purchase.vo.PurchaseAcceptVo;
|
||||
|
|
@ -28,7 +29,9 @@ public interface BpmPurchaseInfoMapper {
|
|||
*/
|
||||
List<PurchaseVo> selectMangerList(PurchaseDto purchaseDto);
|
||||
|
||||
int insertList(@Param("list")List<BpmPurchaseInfo> list);
|
||||
List<PurchaseVo> selectMangerListInId(@Param("idCollection") Collection<Integer> idCollection);
|
||||
|
||||
int insertList(@Param("list") List<BpmPurchaseInfo> list);
|
||||
|
||||
/**
|
||||
* 查询所有设备类型
|
||||
|
|
@ -44,6 +47,13 @@ public interface BpmPurchaseInfoMapper {
|
|||
*/
|
||||
List<PurchaseAcceptVo> getDetailsList(PurchaseDto record);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查询领用明细
|
||||
* @param idCollection 领用详情表ID集合
|
||||
*/
|
||||
List<PurchaseAcceptVo> getDetailsListInId(@Param("idCollection") Collection<Integer> idCollection);
|
||||
|
||||
MaType selectMaTypeById(@Param("id") Integer id);
|
||||
|
||||
/**
|
||||
|
|
@ -53,6 +63,12 @@ public interface BpmPurchaseInfoMapper {
|
|||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* 删除领用明细--逻辑删除
|
||||
*/
|
||||
int updateIsActiveById(@Param("id")Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* insert record to table
|
||||
* @param record the record
|
||||
|
|
@ -85,6 +101,13 @@ public interface BpmPurchaseInfoMapper {
|
|||
*/
|
||||
int updateByPrimaryKeySelective(BpmPurchaseInfo record);
|
||||
|
||||
|
||||
int updateStatusByTaskId(@Param("updatedStatus")Byte updatedStatus,@Param("taskId")Integer taskId);
|
||||
|
||||
int updateStatusByTaskIdIn(@Param("updatedStatus")Byte updatedStatus,@Param("taskIdCollection")Collection<Integer> taskIdCollection);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* update record
|
||||
* @param record the updated record
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package com.bonus.purchase.service.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
|
|
@ -23,6 +21,9 @@ import com.bonus.purchase.domain.BpmPurchaseInfo;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static com.bonus.purchase.utils.Constants.PENDING_SUBMISSION;
|
||||
import static com.bonus.purchase.utils.Constants.PENDING_SUBMISSION_BYTE;
|
||||
|
||||
/**
|
||||
*@PackagePath: com.bonus.purchase
|
||||
*@author : 阮世耀
|
||||
|
|
@ -92,6 +93,17 @@ public class BpmPurchaseInfoService{
|
|||
return bpmPurchaseInfoMapper.getDetailsList(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询--根据ID集合查设备列表
|
||||
*/
|
||||
public List<PurchaseAcceptVo> getDetailsListInId(Collection<Integer> idCollection) {
|
||||
return bpmPurchaseInfoMapper.getDetailsListInId(idCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新购设备任务创建
|
||||
* @param purchaseTaskDto 任务数据、设备数据集合
|
||||
*/
|
||||
public int insertList(PurchaseTaskDto purchaseTaskDto) {
|
||||
// 映射Dto至Pojo对象
|
||||
BpmTask task = new BpmTask();
|
||||
|
|
@ -107,7 +119,7 @@ public class BpmPurchaseInfoService{
|
|||
String code = "XG" + DateTimeHelper.getNowMonthFomart() + "-" + formatTaskNumber;
|
||||
task.setCode(code);
|
||||
// 赋值任务状态
|
||||
task.setStatus(47);
|
||||
task.setStatus(PENDING_SUBMISSION);
|
||||
String creator = String.valueOf(SecurityUtils.getLoginUser().getUserid());
|
||||
task.setCreator(creator);
|
||||
// 处理任务表数据 ---------------- end ------
|
||||
|
|
@ -122,7 +134,7 @@ public class BpmPurchaseInfoService{
|
|||
// 给集合中所有对象赋值任务ID
|
||||
list.replaceAll(obj -> {
|
||||
obj.setTaskId(task.getId());
|
||||
obj.setStatus((byte)47);
|
||||
obj.setStatus(PENDING_SUBMISSION_BYTE);
|
||||
obj.setUpdater(creator);
|
||||
return obj;
|
||||
});
|
||||
|
|
@ -139,6 +151,10 @@ public class BpmPurchaseInfoService{
|
|||
return bpmPurchaseInfoMapper.selectMangerList(purchaseDto);
|
||||
}
|
||||
|
||||
public List<PurchaseVo> selectMangerListInId(Collection<Integer> idCollection) {
|
||||
return bpmPurchaseInfoMapper.selectMangerListInId(idCollection);
|
||||
}
|
||||
|
||||
public MaType selectMaTypeById(Integer id) {
|
||||
return bpmPurchaseInfoMapper.selectMaTypeById(id);
|
||||
}
|
||||
|
|
@ -193,6 +209,22 @@ public class BpmPurchaseInfoService{
|
|||
return itemNode;
|
||||
}
|
||||
|
||||
public int updateStatusByTaskId(Byte updatedStatus,Integer taskId){
|
||||
return bpmPurchaseInfoMapper.updateStatusByTaskId(updatedStatus,taskId);
|
||||
}
|
||||
|
||||
public int updateStatusByTaskId(Byte updatedStatus, Collection<Integer> taskIdCollection){
|
||||
return bpmPurchaseInfoMapper.updateStatusByTaskIdIn(updatedStatus,taskIdCollection);
|
||||
}
|
||||
|
||||
public int updateIsActiveById(Integer id){
|
||||
return bpmPurchaseInfoMapper.updateIsActiveById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,16 +12,31 @@ public class Constants {
|
|||
*/
|
||||
public static final Integer PENDING_SUBMISSION = 47;
|
||||
|
||||
/**
|
||||
* 待提交--byte类型
|
||||
*/
|
||||
public static final Byte PENDING_SUBMISSION_BYTE = 47;
|
||||
|
||||
/**
|
||||
* 待确认
|
||||
*/
|
||||
public static final Integer PENDING_CONFIRMATION = 48;
|
||||
|
||||
/**
|
||||
* 待确认
|
||||
*/
|
||||
public static final Byte PENDING_CONFIRMATION_BYTE = 48;
|
||||
|
||||
/**
|
||||
* 待通知
|
||||
*/
|
||||
public static final Integer PENDING_NOTIFICATION = 49;
|
||||
|
||||
/**
|
||||
* 待通知--byte类型
|
||||
*/
|
||||
public static final Byte PENDING_NOTIFICATION_BYTE = 49;
|
||||
|
||||
/**
|
||||
* 待验收
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ public class PurchaseAcceptVo {
|
|||
private String materialName;
|
||||
|
||||
@ApiModelProperty("规格型号")
|
||||
private String specificationCode;
|
||||
private String materialModel;
|
||||
|
||||
@ApiModelProperty(value="单位")
|
||||
@ApiModelProperty(value="单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value="供应商名称")
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class PurchaseVo {
|
|||
private String materialName;
|
||||
|
||||
@ApiModelProperty("规格型号")
|
||||
private String specificationCode;
|
||||
private String materialModel;
|
||||
|
||||
@ApiModelProperty(value="单位")
|
||||
private String unitName;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.task.mapper;
|
||||
import java.util.Collection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.bonus.task.domain.BpmTask;
|
||||
|
|
@ -63,4 +64,8 @@ public interface BpmTaskMapper {
|
|||
|
||||
int updateStatusById(@Param("updatedStatus")Integer updatedStatus,@Param("id")Integer id);
|
||||
|
||||
int updateStatusByIdIn(@Param("updatedStatus")Integer updatedStatus,@Param("idCollection")Collection<Integer> idCollection);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.task.service;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.task.mapper.BpmTaskMapper;
|
||||
|
|
@ -75,6 +76,13 @@ public class BpmTaskService{
|
|||
return bpmTaskMapper.updateStatusById(updatedStatus,id);
|
||||
}
|
||||
|
||||
public int updateStatusById(Integer updatedStatus, Collection<Integer> idCollection){
|
||||
return bpmTaskMapper.updateStatusByIdIn(updatedStatus,idCollection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT
|
||||
bp.id AS purchaseId,
|
||||
mt1.`name` AS materialName,
|
||||
mt.`name` AS specificationCode,
|
||||
mt.`name` AS materialModel,
|
||||
sda.dict_label AS unitName,
|
||||
bp.purchase_price AS purchasePrice,
|
||||
bp.notax_price AS notaxPrice,
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@
|
|||
SELECT
|
||||
bp.id,
|
||||
mt1.`name` AS materialName,
|
||||
mt.`name` AS specificationCode,
|
||||
mt.`name` AS materialModel,
|
||||
sda.dict_label AS unitName,
|
||||
bp.purchase_price AS purchasePrice,
|
||||
bp.notax_price AS notaxPrice,
|
||||
|
|
@ -696,4 +696,87 @@
|
|||
bp.is_active = '1'
|
||||
AND bp.task_id = #{taskId,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<!--by syruan on 2024-08-22-->
|
||||
<update id="updateStatusByTaskId">
|
||||
update bpm_purchase_info
|
||||
set `status`=#{updatedStatus,jdbcType=TINYINT}
|
||||
where task_id=#{taskId,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<!--by syruan on 2024-08-22-->
|
||||
<update id="updateStatusByTaskIdIn">
|
||||
update bpm_purchase_info
|
||||
set `status`=#{updatedStatus,jdbcType=TINYINT}
|
||||
where task_id in
|
||||
<foreach item="item" index="index" collection="taskIdCollection" open="(" separator="," close=")">
|
||||
#{item,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!--by syruan on 2024-08-22-->
|
||||
<update id="updateIsActiveById">
|
||||
update bpm_purchase_info
|
||||
set is_active = 0
|
||||
where id=#{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectMangerListInId" resultType="com.bonus.purchase.vo.PurchaseVo">
|
||||
SELECT
|
||||
bt.id AS id,
|
||||
bt.arrival_time AS arrivalTime,
|
||||
bt.`code` AS purchaseCode,
|
||||
GROUP_CONCAT( mt.`name` ) AS purchaseMaterial,
|
||||
SUM( bp.purchase_num ) AS purchaseNum,
|
||||
SUM( bp.purchase_price ) AS purchasePrice,
|
||||
SUM( bp.notax_price ) AS notaxPrice,
|
||||
'10' AS taxRate,
|
||||
bt.creator AS createBy,
|
||||
bt.create_time AS createTime,
|
||||
bt.`status` AS STATUS,
|
||||
sda.dict_label AS statusName,
|
||||
bt.remark AS remark
|
||||
FROM
|
||||
bpm_purchase_info bp
|
||||
LEFT JOIN bpm_task bt ON bp.task_id = bt.id
|
||||
LEFT JOIN ma_type mt ON bp.type_id = mt.id
|
||||
LEFT JOIN sys_dict_data sda ON sda.dict_code = bt.`status`
|
||||
WHERE
|
||||
bt.is_active = '1'
|
||||
AND bp.task_id IN
|
||||
<foreach item="item" index="index" collection="idCollection" open="(" separator="," close=")">
|
||||
#{item,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
GROUP BY
|
||||
bp.task_id
|
||||
</select>
|
||||
|
||||
<select id="getDetailsListInId" resultType="com.bonus.purchase.vo.PurchaseAcceptVo">
|
||||
SELECT
|
||||
bp.id,
|
||||
mt1.`name` AS materialName,
|
||||
mt.`name` AS materialModel,
|
||||
sda.dict_label AS unitName,
|
||||
bp.purchase_price AS purchasePrice,
|
||||
bp.notax_price AS notaxPrice,
|
||||
bp.purchase_num AS purchaseNum,
|
||||
bs.`name` AS supplierName,
|
||||
bp.product_date AS productDate,
|
||||
bp.`status` AS STATUS,
|
||||
sda1.dict_label AS statusName
|
||||
FROM
|
||||
bpm_purchase_info bp
|
||||
LEFT JOIN bpm_task bt ON bp.task_id = bt.id
|
||||
LEFT JOIN ma_type mt ON bp.type_id = mt.id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.id
|
||||
LEFT JOIN sys_dict_data sda ON mt.unit_id = sda.dict_code
|
||||
LEFT JOIN bm_supplier bs ON bp.supplier_id = bs.id
|
||||
LEFT JOIN sys_dict_data sda1 ON sda1.dict_code = bp.`status`
|
||||
WHERE
|
||||
bp.is_active = '1'
|
||||
AND bp.id IN
|
||||
<foreach item="item" index="index" collection="idCollection" open="(" separator="," close=")">
|
||||
#{item,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
SELECT
|
||||
bp.id AS id,
|
||||
mt1.`name` AS materialName,
|
||||
mt.`name` AS specificationCode,
|
||||
mt.`name` AS materialModel,
|
||||
sda.dict_label AS unitName,
|
||||
bp.purchase_price AS purchasePrice,
|
||||
bp.notax_price AS notaxPrice,
|
||||
|
|
|
|||
|
|
@ -405,4 +405,13 @@
|
|||
where id=#{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<!--by syruan on 2024-08-22-->
|
||||
<update id="updateStatusByIdIn">
|
||||
update bpm_task
|
||||
set `status`=#{updatedStatus,jdbcType=INTEGER}
|
||||
where id in
|
||||
<foreach item="item" index="index" collection="idCollection" open="(" separator="," close=")">
|
||||
#{item,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue