新购提交、新购确认接口开发
This commit is contained in:
parent
e82c4047f6
commit
f4d8dc4954
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 短信人员(bpm_notice_user)表控制层
|
||||
*
|
||||
* 新购到货通知业务
|
||||
* @author 阮世耀
|
||||
*/
|
||||
@RestController
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
|||
* @create 2024/8/19 16:13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/acceptance")
|
||||
@RequestMapping("/purchase/acceptance")
|
||||
public class BpmPurchaseAcceptController extends BaseController {
|
||||
|
||||
@Resource
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@ import com.bonus.purchase.dto.PurchaseDto;
|
|||
import com.bonus.purchase.dto.PurchaseTaskDto;
|
||||
import com.bonus.purchase.service.impl.BpmPurchaseInfoService;
|
||||
import com.bonus.purchase.vo.PurchaseVo;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import com.bonus.task.service.BpmTaskService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
|
@ -20,11 +21,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 新购到货验收表(bpm_purchase_info)控制层
|
||||
* 新购到货管理(bpm_purchase_info)
|
||||
* @author 阮世耀
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/arrival")
|
||||
@RequestMapping("/purchase/arrival")
|
||||
public class BpmPurchaseInfoController extends BaseController {
|
||||
|
||||
/**
|
||||
|
|
@ -33,6 +34,8 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
@Autowired
|
||||
private BpmPurchaseInfoService bpmPurchaseInfoService;
|
||||
|
||||
@Resource
|
||||
private BpmTaskService bpmTaskService;
|
||||
|
||||
/**
|
||||
* 分页查询--新购任务列表
|
||||
|
|
@ -68,13 +71,40 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
* ElementPlus级联选择器数据接口--根据id查询节点的父级信息
|
||||
*/
|
||||
@GetMapping(value = "/cascaderById")
|
||||
public ResultBean<Object> getCascaderDataById(@RequestParam("id")
|
||||
@NotNull(message = "ID不能为空")
|
||||
public ResultBean<Object> getCascaderDataById(@RequestParam("id") @NotNull(message = "ID不能为空")
|
||||
@Positive(message = "ID必须为正整数") Integer id) {
|
||||
return ResultBean.success(this.bpmPurchaseInfoService.selectMaTypeById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新购任务--提交任务
|
||||
* @param taskArray 任务id数组
|
||||
*/
|
||||
@PutMapping(value = "/commit")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:edit")
|
||||
public ResultBean<Boolean> commit(@RequestBody @NotEmpty Integer[] taskArray) {
|
||||
int result = 0;
|
||||
for (Integer taskId : taskArray) {
|
||||
result += this.bpmTaskService.updateStatusById(48, taskId);
|
||||
}
|
||||
return ResultBean.toIsSuccess(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新购任务--确认任务
|
||||
* @param taskArray 任务id数组
|
||||
*/
|
||||
@PutMapping(value = "/confirm")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:edit")
|
||||
public ResultBean<Boolean> confirm(@RequestBody @NotEmpty Integer[] taskArray) {
|
||||
int result = 0;
|
||||
for (Integer taskId : taskArray) {
|
||||
result += this.bpmTaskService.updateStatusById(49, taskId);
|
||||
}
|
||||
return ResultBean.toIsSuccess(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
|
|
@ -83,21 +113,20 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
*/
|
||||
@GetMapping("{id}")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:query")
|
||||
public ResultBean<BpmPurchaseInfo> queryById(@NotNull(message = "ID不能为空")
|
||||
@PathVariable("id")
|
||||
@Positive(message = "ID必须为正整数") Integer id) {
|
||||
public ResultBean<BpmPurchaseInfo> queryById(@PathVariable("id") @NotNull(message = "ID不能为空")
|
||||
@Positive(message = "ID必须为正整数") Integer id) {
|
||||
return ResultBean.success(this.bpmPurchaseInfoService.selectByPrimaryKey(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据---批量导入
|
||||
* 新购管理--物资新增
|
||||
*
|
||||
* @param purchaseTaskDto 新购设备DTO
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:add")
|
||||
public ResultBean<Boolean> add(@RequestBody PurchaseTaskDto purchaseTaskDto) {
|
||||
public ResultBean<Boolean> add(@RequestBody @NotNull(message = "参数不能为空") @Valid PurchaseTaskDto purchaseTaskDto) {
|
||||
return ResultBean.toIsSuccess(this.bpmPurchaseInfoService.insertList(purchaseTaskDto));
|
||||
}
|
||||
|
||||
|
|
@ -110,12 +139,11 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
@PutMapping(value = "/update")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:edit")
|
||||
public ResultBean< Boolean> edit(@RequestBody @NotNull(message = "参数不能为空") BpmPurchaseInfo bpmPurchaseInfo) {
|
||||
this.bpmPurchaseInfoService.updateByPrimaryKeySelective(bpmPurchaseInfo);
|
||||
return ResultBean.success(true);
|
||||
return ResultBean.toIsSuccess(this.bpmPurchaseInfoService.updateByPrimaryKeySelective(bpmPurchaseInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* 删除--外层task任务
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
|
|
@ -123,7 +151,15 @@ public class BpmPurchaseInfoController extends BaseController {
|
|||
@DeleteMapping(value = "/delete/{id}")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:remove")
|
||||
public ResultBean< Boolean> deleteById(@PathVariable("id") Integer id) {
|
||||
this.bpmPurchaseInfoService.deleteByPrimaryKey(id);
|
||||
return ResultBean.success(true);
|
||||
return ResultBean.toIsSuccess(this.bpmTaskService.deleteByPrimaryKey(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除--内层设备明细数据
|
||||
*/
|
||||
@DeleteMapping(value = "/deleteDetails/{id}")
|
||||
@RequiresPermissions("purchase:bpmPurchaseInfo:remove")
|
||||
public ResultBean< Boolean> deleteDetailsById(@PathVariable("id") Integer id) {
|
||||
return ResultBean.toIsSuccess(this.bpmPurchaseInfoService.deleteByPrimaryKey(id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.purchase.domain.BpmPurchaseInfo;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -18,6 +19,7 @@ import java.util.List;
|
|||
public class PurchaseTaskDto implements Serializable {
|
||||
|
||||
@ApiModelProperty(value="到货时间")
|
||||
@NotNull(message = "到货时间不能为空")
|
||||
private Date arrivalTime;
|
||||
|
||||
@ApiModelProperty(value="备注")
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class BpmTaskController extends BaseController {
|
|||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping(value = "/add")
|
||||
public ResultBean< Boolean> add(@NotNull @RequestBody BpmTask bpmTask) {
|
||||
public ResultBean<Boolean> add(@NotNull @RequestBody BpmTask bpmTask) {
|
||||
this.bpmTaskService.insertSelective(bpmTask);
|
||||
return ResultBean.success(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.task.mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.bonus.task.domain.BpmTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -60,5 +61,6 @@ public interface BpmTaskMapper {
|
|||
|
||||
Integer countById();
|
||||
|
||||
int updateStatusById(@Param("updatedStatus")Integer updatedStatus,@Param("id")Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
package com.bonus.task.service;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.task.mapper.BpmTaskMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -64,6 +65,16 @@ public class BpmTaskService{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据id修改任务状态
|
||||
* @param updatedStatus 修改后的状态
|
||||
* @param id 任务id
|
||||
* @return 影响行数
|
||||
*/
|
||||
public int updateStatusById(Integer updatedStatus,Integer id){
|
||||
return bpmTaskMapper.updateStatusById(updatedStatus,id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@
|
|||
LEFT JOIN ma_type mt ON bp.type_id = mt.id
|
||||
LEFT JOIN sys_dict_data sda ON sda.dict_code = bt.`status`
|
||||
WHERE
|
||||
bp.is_active = '1'
|
||||
bt.is_active = '1'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND bt.arrival_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@
|
|||
from bpm_task
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
delete from bpm_task
|
||||
update bpm_task set is_active = 0
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" parameterType="com.bonus.task.domain.BpmTask">
|
||||
<!--@mbg.generated-->
|
||||
insert into bpm_task (id, definition_id, parent_id,
|
||||
|
|
@ -396,4 +397,12 @@
|
|||
<select id="countById" resultType="java.lang.Integer">
|
||||
select count(id) from bpm_task
|
||||
</select>
|
||||
|
||||
<!--by syruan on 2024-08-21-->
|
||||
<update id="updateStatusById">
|
||||
update bpm_task
|
||||
set `status`=#{updatedStatus,jdbcType=INTEGER}
|
||||
where id=#{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue