Merge branch 'master' into branch_basic
This commit is contained in:
commit
a926edc370
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.bonus.material.purchase.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : 阮世耀
|
||||||
|
* @version : 1.0
|
||||||
|
* @PackagePath: com.bonus.material.purchase.config
|
||||||
|
* @CreateTime: 2024-10-22 13:08
|
||||||
|
* @Description: 新购任务信息枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum PurchaseTaskEnum {
|
||||||
|
|
||||||
|
PURCHASE_TASK_STATUS_WAIT_SUBMIT(122, 0, "待提交", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_WAIT_NOTICE(123, 1, "待通知", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_WAIT_CHECK(124, 2,"待验收", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_WAIT_BIND(125, 3,"待绑定", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_WAIT_IN(126, 4,"待入库", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_FINISH_OK(127, 5,"已完成", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_CHECK_NO(128, 6,"待验收(驳回后)", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_BIND_NO(129, 7,"待绑定(驳回后)", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_IN_NO(130, 8,"待入库(驳回后)", "purchase_task_status", 0),
|
||||||
|
PURCHASE_TASK_STATUS_PART_IN(131, 9,"入库进行中", "purchase_task_status", 0);
|
||||||
|
|
||||||
|
|
||||||
|
private final Integer taskStatusCode;
|
||||||
|
private final Integer taskStatusValue;
|
||||||
|
private final String taskStatusName;
|
||||||
|
private final String taskTypeValue;
|
||||||
|
private final Integer taskTypeId;
|
||||||
|
|
||||||
|
PurchaseTaskEnum(Integer taskStatusCode, Integer taskStatusValue, String taskStatusName, String taskTypeValue, Integer taskTypeId) {
|
||||||
|
this.taskStatusCode = taskStatusCode;
|
||||||
|
this.taskStatusValue = taskStatusValue;
|
||||||
|
this.taskStatusName = taskStatusName;
|
||||||
|
this.taskTypeValue = taskTypeValue;
|
||||||
|
this.taskTypeId = taskTypeId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,14 +11,7 @@ import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
|
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.bonus.common.log.annotation.SysLog;
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||||
|
|
@ -125,17 +118,17 @@ public class PurchaseCheckDetailsController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "根据任务id查询报告附件")
|
@ApiOperation(value = "根据任务id查询报告附件")
|
||||||
@RequiresPermissions("purchase:details:query")
|
@RequiresPermissions("purchase:details:query")
|
||||||
@GetMapping("/fileList/{taskId}")
|
@GetMapping("/fileList")
|
||||||
@SysLog(title = "新购验收任务明细报告查询", businessType = OperaType.QUERY, module = "物资新购->根据任务id查询物资报告附件")
|
@SysLog(title = "新购验收任务明细报告查询", businessType = OperaType.QUERY, module = "物资新购->根据任务id查询物资报告附件")
|
||||||
public AjaxResult getFileList(@PathVariable("taskId") Long taskId) {
|
public AjaxResult getFileList(@RequestParam("taskId") Long taskId, @RequestParam("typeId") Long typeId) {
|
||||||
return success(purchaseCheckDetailsService.selectPurchaseCheckFileListByTaskId(taskId));
|
return success(purchaseCheckDetailsService.selectPurchaseCheckFileListByTaskId(taskId, typeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "上传文件")
|
@ApiOperation(value = "上传报告附件")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:details:add")
|
@RequiresPermissions("purchase:details:add")
|
||||||
@SysLog(title = "上传文件", businessType = OperaType.INSERT, logType = 1,module = "物资新购->上传物资报告附件")
|
@SysLog(title = "上传报告附件", businessType = OperaType.INSERT, logType = 1,module = "物资新购->上传物资报告附件")
|
||||||
@PostMapping("/uploadFile")
|
@PostMapping("/uploadFile")
|
||||||
public AjaxResult uploadFile(@RequestBody @NotNull @Valid PurchaseCheckFileDto purchaseCheckFileDto) {
|
public AjaxResult uploadFile(@RequestBody @NotNull @Valid PurchaseCheckFileDto purchaseCheckFileDto) {
|
||||||
return purchaseCheckDetailsService.insertPurchaseCheckFile(purchaseCheckFileDto);
|
return purchaseCheckDetailsService.insertPurchaseCheckFile(purchaseCheckFileDto);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
|
|
@ -12,14 +13,7 @@ import com.bonus.material.purchase.dto.PurchaseCheckDto;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.bonus.common.log.annotation.SysLog;
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
|
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
|
||||||
|
|
@ -32,8 +26,7 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
/**
|
/**
|
||||||
* 新购验收任务Controller
|
* 新购验收任务Controller
|
||||||
*
|
*
|
||||||
* @author xsheng
|
* @author syruan
|
||||||
* @date 2024-10-16
|
|
||||||
*/
|
*/
|
||||||
@Api(tags = "新购验收任务接口")
|
@Api(tags = "新购验收任务接口")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -72,7 +65,7 @@ public class PurchaseCheckInfoController extends BaseController {
|
||||||
@ApiOperation(value = "新增新购验收任务")
|
@ApiOperation(value = "新增新购验收任务")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:info:add")
|
@RequiresPermissions("purchase:info:add")
|
||||||
@SysLog(title = "新购验收任务", businessType = OperaType.INSERT, module = "仓储管理->新增新购验收任务")
|
@SysLog(title = "新购验收任务", businessType = OperaType.INSERT, module = "物资新购->新增新购验收任务")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Valid @NotNull @RequestBody PurchaseCheckDto purchaseCheckDto) {
|
public AjaxResult add(@Valid @NotNull @RequestBody PurchaseCheckDto purchaseCheckDto) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -88,7 +81,7 @@ public class PurchaseCheckInfoController extends BaseController {
|
||||||
@ApiOperation(value = "修改新购验收任务")
|
@ApiOperation(value = "修改新购验收任务")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:info:edit")
|
@RequiresPermissions("purchase:info:edit")
|
||||||
@SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, module = "仓储管理->修改新购验收任务")
|
@SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, module = "物资新购->修改新购验收任务")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody PurchaseCheckInfo purchaseCheckInfo) {
|
public AjaxResult edit(@RequestBody PurchaseCheckInfo purchaseCheckInfo) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -98,13 +91,27 @@ public class PurchaseCheckInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验收合格API
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "外层批量验收合格API")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
@RequiresPermissions("purchase:info:edit")
|
||||||
|
@SysLog(title = "新购验收任务", businessType = OperaType.UPDATE, module = "物资新购->外层批量验收合格API")
|
||||||
|
@PutMapping("/acceptance")
|
||||||
|
public AjaxResult acceptance(@RequestBody @NotEmpty(message = "任务id集合不能为空") List<Long> taskIds) {
|
||||||
|
return purchaseCheckInfoService.acceptance(taskIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除新购验收任务
|
* 删除新购验收任务
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "删除新购验收任务")
|
@ApiOperation(value = "删除新购验收任务")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:info:remove")
|
@RequiresPermissions("purchase:info:remove")
|
||||||
@SysLog(title = "新购验收任务", businessType = OperaType.DELETE, module = "仓储管理->删除新购验收任务")
|
@SysLog(title = "新购验收任务", businessType = OperaType.DELETE, module = "物资新购->删除新购验收任务")
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
return toAjax(purchaseCheckInfoService.deletePurchaseCheckInfoByIds(ids));
|
return toAjax(purchaseCheckInfoService.deletePurchaseCheckInfoByIds(ids));
|
||||||
|
|
@ -118,7 +125,7 @@ public class PurchaseCheckInfoController extends BaseController {
|
||||||
@ApiOperation(value = "导出新购验收任务列表")
|
@ApiOperation(value = "导出新购验收任务列表")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:info:export")
|
@RequiresPermissions("purchase:info:export")
|
||||||
@SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, module = "仓储管理->导出新购验收任务")
|
@SysLog(title = "新购验收任务", businessType = OperaType.EXPORT, module = "物资新购->导出新购验收任务")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
|
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
|
||||||
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo);
|
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo);
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ public class PurchaseNoticePersonController extends BaseController {
|
||||||
@ApiOperation(value = "导出新购短信通知人员列表")
|
@ApiOperation(value = "导出新购短信通知人员列表")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:person:export")
|
@RequiresPermissions("purchase:person:export")
|
||||||
@SysLog(title = "新购短信通知人员", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购短信通知人员")
|
@SysLog(title = "新购短信通知人员", businessType = OperaType.EXPORT, module = "物资新购->导出新购短信通知人员")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, PurchaseNoticePerson purchaseNoticePerson) {
|
public void export(HttpServletResponse response, PurchaseNoticePerson purchaseNoticePerson) {
|
||||||
List<PurchaseNoticePerson> list = purchaseNoticePersonService.selectPurchaseNoticePersonList(purchaseNoticePerson);
|
List<PurchaseNoticePerson> list = purchaseNoticePersonService.selectPurchaseNoticePersonList(purchaseNoticePerson);
|
||||||
|
|
@ -83,7 +83,7 @@ public class PurchaseNoticePersonController extends BaseController {
|
||||||
@ApiOperation(value = "新增新购短信通知人员")
|
@ApiOperation(value = "新增新购短信通知人员")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:person:add")
|
@RequiresPermissions("purchase:person:add")
|
||||||
@SysLog(title = "新购短信通知人员", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购短信通知人员")
|
@SysLog(title = "新购短信通知人员", businessType = OperaType.INSERT, module = "物资新购->新增新购短信通知人员")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody PurchaseNoticePerson purchaseNoticePerson) {
|
public AjaxResult add(@RequestBody PurchaseNoticePerson purchaseNoticePerson) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -99,7 +99,7 @@ public class PurchaseNoticePersonController extends BaseController {
|
||||||
@ApiOperation(value = "批量新增新购短信通知人员")
|
@ApiOperation(value = "批量新增新购短信通知人员")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:person:add")
|
@RequiresPermissions("purchase:person:add")
|
||||||
@SysLog(title = "批量新增新购短信通知人员", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->批量新增新购短信通知人员")
|
@SysLog(title = "批量新增新购短信通知人员", businessType = OperaType.INSERT, module = "物资新购->批量新增新购短信通知人员")
|
||||||
@PostMapping("/batchAddNoticePerson")
|
@PostMapping("/batchAddNoticePerson")
|
||||||
public AjaxResult batchAddNoticePerson(@RequestBody List<PurchaseNoticePerson> purchaseNoticePersonList) {
|
public AjaxResult batchAddNoticePerson(@RequestBody List<PurchaseNoticePerson> purchaseNoticePersonList) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -115,7 +115,7 @@ public class PurchaseNoticePersonController extends BaseController {
|
||||||
@ApiOperation(value = "批量发送短信")
|
@ApiOperation(value = "批量发送短信")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:person:edit")
|
@RequiresPermissions("purchase:person:edit")
|
||||||
@SysLog(title = "批量发送短信", businessType = OperaType.UPDATE, module = "仓储管理->批量发送短信")
|
@SysLog(title = "批量发送短信", businessType = OperaType.UPDATE, module = "物资新购->批量发送短信")
|
||||||
@PutMapping("/batchSendSms")
|
@PutMapping("/batchSendSms")
|
||||||
public AjaxResult batchSendSms(@NotNull @Valid @RequestBody PurchaseNoticePersonDto purchaseNoticePersonDto) {
|
public AjaxResult batchSendSms(@NotNull @Valid @RequestBody PurchaseNoticePersonDto purchaseNoticePersonDto) {
|
||||||
return purchaseNoticePersonService.batchSendSms(purchaseNoticePersonDto);
|
return purchaseNoticePersonService.batchSendSms(purchaseNoticePersonDto);
|
||||||
|
|
@ -127,7 +127,7 @@ public class PurchaseNoticePersonController extends BaseController {
|
||||||
@ApiOperation(value = "修改新购短信通知人员")
|
@ApiOperation(value = "修改新购短信通知人员")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:person:edit")
|
@RequiresPermissions("purchase:person:edit")
|
||||||
@SysLog(title = "新购短信通知人员", businessType = OperaType.UPDATE, module = "仓储管理->修改新购短信通知人员")
|
@SysLog(title = "新购短信通知人员", businessType = OperaType.UPDATE, module = "物资新购->修改新购短信通知人员")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody PurchaseNoticePerson purchaseNoticePerson) {
|
public AjaxResult edit(@RequestBody PurchaseNoticePerson purchaseNoticePerson) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -143,7 +143,7 @@ public class PurchaseNoticePersonController extends BaseController {
|
||||||
@ApiOperation(value = "删除新购短信通知人员")
|
@ApiOperation(value = "删除新购短信通知人员")
|
||||||
@PreventRepeatSubmit
|
@PreventRepeatSubmit
|
||||||
@RequiresPermissions("purchase:person:remove")
|
@RequiresPermissions("purchase:person:remove")
|
||||||
@SysLog(title = "新购短信通知人员", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除新购短信通知人员")
|
@SysLog(title = "新购短信通知人员", businessType = OperaType.DELETE, module = "物资新购->删除新购短信通知人员")
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
return toAjax(purchaseNoticePersonService.deletePurchaseNoticePersonByIds(ids));
|
return toAjax(purchaseNoticePersonService.deletePurchaseNoticePersonByIds(ids));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bonus.material.purchase.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : 阮世耀
|
||||||
|
* @version : 1.0
|
||||||
|
* @PackagePath: com.bonus.material.purchase.dto
|
||||||
|
* @CreateTime: 2024-10-22 17:43
|
||||||
|
* @Description: 物资新购验收任务Dto
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PurchaseAcceptDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务id")
|
||||||
|
private Long taskId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务状态")
|
||||||
|
private Integer taskStatus;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -30,6 +30,10 @@ public class PurchaseCheckFileDto {
|
||||||
@NotBlank(message = "任务ID不能为空")
|
@NotBlank(message = "任务ID不能为空")
|
||||||
private String taskId;
|
private String taskId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物资类型ID")
|
||||||
|
@NotBlank(message = "物资类型ID不能为空")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "字典编码")
|
@ApiModelProperty(value = "字典编码")
|
||||||
@NotEmpty(message = "字典编码不能为空")
|
@NotEmpty(message = "字典编码不能为空")
|
||||||
private Integer dictCode;
|
private Integer dictCode;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.material.purchase.dto;
|
package com.bonus.material.purchase.dto;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
|
@ -32,4 +33,11 @@ public class PurchaseNoticePersonDto {
|
||||||
@NotNull(message = "短信内容不能为空")
|
@NotNull(message = "短信内容不能为空")
|
||||||
@ApiModelProperty(value = "短信内容")
|
@ApiModelProperty(value = "短信内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "任务id不能为空")
|
||||||
|
@ApiModelProperty(value = "任务id")
|
||||||
|
private Long taskId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,14 @@ public interface PurchaseCheckDetailsMapper {
|
||||||
*/
|
*/
|
||||||
int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
|
int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改新购验收任务详细状态 -- 批量、限制状态
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @param oldTaskStatus 旧状态
|
||||||
|
* @param newTaskStatus 新状态
|
||||||
|
*/
|
||||||
|
int batchUpdateDetailsTaskStatus(@Param("taskId") Long taskId, @Param("oldTaskStatus") Integer oldTaskStatus, @Param("newTaskStatus") Integer newTaskStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除新购验收任务详细
|
* 删除新购验收任务详细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.purchase.mapper;
|
||||||
|
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||||
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
|
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -16,8 +17,9 @@ public interface PurchaseCheckFileMapper {
|
||||||
/**
|
/**
|
||||||
* 根据任务id查询新购验收任务详细报告列表--Join查询
|
* 根据任务id查询新购验收任务详细报告列表--Join查询
|
||||||
* @param taskId 任务id
|
* @param taskId 任务id
|
||||||
|
* @param typeId 规格id
|
||||||
*/
|
*/
|
||||||
List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId);
|
List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(@Param("taskId") Long taskId, @Param("typeId") Long typeId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||||
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
|
import com.bonus.material.purchase.dto.PurchaseCheckFileDto;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新购验收任务详细Service接口
|
* 新购验收任务详细Service接口
|
||||||
|
|
@ -33,7 +34,7 @@ public interface IPurchaseCheckDetailsService {
|
||||||
* 根据任务ID查询报告附件列表
|
* 根据任务ID查询报告附件列表
|
||||||
* @param taskId 任务id
|
* @param taskId 任务id
|
||||||
*/
|
*/
|
||||||
List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId);
|
List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId, Long typeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增报告附件
|
* 新增报告附件
|
||||||
|
|
@ -57,6 +58,14 @@ public interface IPurchaseCheckDetailsService {
|
||||||
*/
|
*/
|
||||||
int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
|
int updatePurchaseCheckDetails(PurchaseCheckDetails purchaseCheckDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改新购验收任务详细状态 -- 批量、限制状态
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @param oldTaskStatus 旧状态
|
||||||
|
* @param newTaskStatus 新状态
|
||||||
|
*/
|
||||||
|
int batchUpdateDetailsTaskStatus(@Param("taskId") Long taskId, @Param("oldTaskStatus") Integer oldTaskStatus, @Param("newTaskStatus") Integer newTaskStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除新购验收任务详细
|
* 批量删除新购验收任务详细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,12 @@ public interface IPurchaseCheckInfoService {
|
||||||
*/
|
*/
|
||||||
AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckDto);
|
AjaxResult insertPurchaseCheckInfo(PurchaseCheckDto purchaseCheckDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验收通过
|
||||||
|
* @param taskId 新购验收任务id
|
||||||
|
*/
|
||||||
|
AjaxResult acceptance(List<Long> taskId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改新购验收任务
|
* 修改新购验收任务
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,9 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
|
||||||
* @param taskId 任务id
|
* @param taskId 任务id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId) {
|
public List<PurchaseCheckFileDto> selectPurchaseCheckFileListByTaskId(Long taskId, Long typeId) {
|
||||||
try {
|
try {
|
||||||
return purchaseCheckFileMapper.selectPurchaseCheckFileListByTaskId(taskId);
|
return purchaseCheckFileMapper.selectPurchaseCheckFileListByTaskId(taskId, typeId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("SQL执行错误:" + e.getMessage());
|
throw new RuntimeException("SQL执行错误:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -76,8 +76,6 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
|
||||||
public AjaxResult insertPurchaseCheckFile(PurchaseCheckFileDto purchaseCheckFileDto) {
|
public AjaxResult insertPurchaseCheckFile(PurchaseCheckFileDto purchaseCheckFileDto) {
|
||||||
try {
|
try {
|
||||||
if (purchaseCheckFileDto != null) {
|
if (purchaseCheckFileDto != null) {
|
||||||
// TODO: 暂定魔法值,字典表为26,后续抽出定义为常量
|
|
||||||
purchaseCheckFileDto.setModelId(26);
|
|
||||||
purchaseCheckFileDto.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
purchaseCheckFileDto.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||||
}
|
}
|
||||||
return purchaseCheckFileMapper.insertPurchaseCheckFiles(purchaseCheckFileDto) > 0 ? AjaxResult.success() : AjaxResult.error("SQL插入0条");
|
return purchaseCheckFileMapper.insertPurchaseCheckFiles(purchaseCheckFileDto) > 0 ? AjaxResult.success() : AjaxResult.error("SQL插入0条");
|
||||||
|
|
@ -118,6 +116,18 @@ public class PurchaseCheckDetailsServiceImpl implements IPurchaseCheckDetailsSer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量修改新购验收任务详细状态 -- 批量、限制状态
|
||||||
|
*
|
||||||
|
* @param taskId 任务id
|
||||||
|
* @param oldTaskStatus 旧状态
|
||||||
|
* @param newTaskStatus 新状态
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int batchUpdateDetailsTaskStatus(Long taskId, Integer oldTaskStatus, Integer newTaskStatus) {
|
||||||
|
return purchaseCheckDetailsMapper.batchUpdateDetailsTaskStatus(taskId, oldTaskStatus, newTaskStatus);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除新购验收任务详细
|
* 批量删除新购验收任务详细
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.bonus.material.purchase.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
@ -10,24 +9,26 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.purchase.config.PurchaseTaskEnum;
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||||
import com.bonus.material.purchase.dto.PurchaseCheckDto;
|
import com.bonus.material.purchase.dto.PurchaseCheckDto;
|
||||||
import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper;
|
import com.bonus.material.purchase.mapper.PurchaseCheckDetailsMapper;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import com.bonus.material.task.mapper.TmTaskMapper;
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import org.apache.ibatis.reflection.ArrayUtil;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper;
|
import com.bonus.material.purchase.mapper.PurchaseCheckInfoMapper;
|
||||||
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
|
import com.bonus.material.purchase.domain.PurchaseCheckInfo;
|
||||||
import com.bonus.material.purchase.service.IPurchaseCheckInfoService;
|
import com.bonus.material.purchase.service.IPurchaseCheckInfoService;
|
||||||
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新购验收任务Service业务层处理
|
* 新购验收任务Service业务层处理
|
||||||
|
|
@ -37,6 +38,11 @@ import javax.validation.constraints.NotNull;
|
||||||
@Service
|
@Service
|
||||||
public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
||||||
|
|
||||||
|
public static final String TASK_TYPE_LABEL = "XG";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PlatformTransactionManager transactionManager;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PurchaseCheckInfoMapper purchaseCheckInfoMapper;
|
private PurchaseCheckInfoMapper purchaseCheckInfoMapper;
|
||||||
|
|
||||||
|
|
@ -153,48 +159,103 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
|
||||||
// 赋值创建时间
|
// 赋值创建时间
|
||||||
purchaseCheckInfo.getPurchaseCheckInfo().setCreateTime(DateUtils.getNowDate());
|
purchaseCheckInfo.getPurchaseCheckInfo().setCreateTime(DateUtils.getNowDate());
|
||||||
try {
|
try {
|
||||||
// TODO: 任务类型、XG 待完善,先定义死,后期修改至配置中心
|
|
||||||
|
|
||||||
// 查询新购任务当月最大单号
|
// 查询新购任务当月最大单号
|
||||||
Integer thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), 16L);
|
Integer thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), Long.valueOf(PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_NOTICE.getTaskTypeId()));
|
||||||
// 查询出的单号值,进行必要性校正
|
// 查询出的单号值,进行必要性校正
|
||||||
if (thisMonthMaxOrder == null || thisMonthMaxOrder == 0) {
|
thisMonthMaxOrder = Optional.ofNullable(thisMonthMaxOrder).orElse(0);
|
||||||
thisMonthMaxOrder = 1;
|
|
||||||
} else {
|
|
||||||
thisMonthMaxOrder = thisMonthMaxOrder + 1;
|
|
||||||
}
|
|
||||||
// 生成单号
|
// 生成单号
|
||||||
String taskCode = "XG" + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder);
|
TmTask tmTask = genderTaskCode(purchaseCheckInfo, thisMonthMaxOrder);
|
||||||
|
Long taskId;
|
||||||
|
|
||||||
// 先往tm_task任务表中创建任务
|
// 开启事务
|
||||||
TmTask tmTask = new TmTask(null, 16L, 55L, taskCode, purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1);
|
TransactionStatus transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());
|
||||||
Long taskId = 0L;
|
|
||||||
if (tmTaskMapper.insertTmTask(tmTask) > 0) {
|
if (tmTaskMapper.insertTmTask(tmTask) > 0) {
|
||||||
taskId = tmTask.getTaskId();
|
taskId = tmTask.getTaskId();
|
||||||
} else {
|
} else {
|
||||||
|
transactionManager.rollback(transactionStatus);
|
||||||
return AjaxResult.error("新增任务失败_task表插入0条");
|
return AjaxResult.error("新增任务失败_task表插入0条");
|
||||||
}
|
}
|
||||||
|
|
||||||
// tm_task 插入成功后,再往新购验收info表中插入数据
|
// tm_task 插入成功后,再往新购验收info表中插入数据
|
||||||
purchaseCheckInfo.getPurchaseCheckInfo().setTaskId(taskId);
|
purchaseCheckInfo.getPurchaseCheckInfo().setTaskId(taskId);
|
||||||
if (purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo.getPurchaseCheckInfo()) > 0) {
|
if (purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo.getPurchaseCheckInfo()) > 0) {
|
||||||
Long finalTaskId = taskId;
|
|
||||||
purchaseCheckInfo.getPurchaseCheckDetailsList().forEach(
|
purchaseCheckInfo.getPurchaseCheckDetailsList().forEach(
|
||||||
details -> {
|
details -> {
|
||||||
details.setTaskId(finalTaskId);
|
details.setTaskId(taskId);
|
||||||
details.setInputStatus("0");
|
details.setInputStatus("0");
|
||||||
});
|
});
|
||||||
// 批量插入详情数据
|
// 批量插入详情数据
|
||||||
boolean purchaseCheckDetailsListAddResult = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckInfo.getPurchaseCheckDetailsList()) > 0;
|
boolean purchaseCheckDetailsListAddResult = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckInfo.getPurchaseCheckDetailsList()) > 0;
|
||||||
return purchaseCheckDetailsListAddResult ? AjaxResult.success("新增任务成功") : AjaxResult.error("新增任务失败,详情表插入0条");
|
if (purchaseCheckDetailsListAddResult) {
|
||||||
|
transactionManager.commit(transactionStatus);
|
||||||
|
return AjaxResult.success("新增任务成功");
|
||||||
} else {
|
} else {
|
||||||
|
transactionManager.rollback(transactionStatus);
|
||||||
|
return AjaxResult.error("新增任务失败,详情表插入0条");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
transactionManager.rollback(transactionStatus);
|
||||||
return AjaxResult.error("新增任务失败,info表插入0条");
|
return AjaxResult.error("新增任务失败,info表插入0条");
|
||||||
}
|
}
|
||||||
|
} catch (DataAccessException e) {
|
||||||
|
return AjaxResult.error("数据库操作失败:" + e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return AjaxResult.error("新增任务失败:" + e.getMessage());
|
return AjaxResult.error("新增任务失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验收通过
|
||||||
|
*
|
||||||
|
* @param taskIds 新购验收任务id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult acceptance(List<Long> taskIds) {
|
||||||
|
try {
|
||||||
|
// 定义返回对象
|
||||||
|
AjaxResult result = new AjaxResult();
|
||||||
|
// 数据过滤
|
||||||
|
taskIds.removeIf(Objects::isNull);
|
||||||
|
// 执行业务逻辑
|
||||||
|
for (Long taskId : taskIds) {
|
||||||
|
// 修改tm_task任务状态
|
||||||
|
boolean updateResult = tmTaskMapper.updateTmTaskStatusByTaskId(taskId,
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_CHECK.getTaskStatusValue(),
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_BIND.getTaskStatusValue()
|
||||||
|
) > 0;
|
||||||
|
|
||||||
|
if (updateResult) {
|
||||||
|
result = purchaseCheckDetailsMapper.batchUpdateDetailsTaskStatus(taskId,
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_CHECK.getTaskStatusValue(),
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_BIND.getTaskStatusValue()
|
||||||
|
) > 0 ? AjaxResult.success("验收通过,修改任务状态成功") : AjaxResult.error("修改任务明细失败");
|
||||||
|
} else {
|
||||||
|
result = AjaxResult.error("SQL未报错,但修改任务0条");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return AjaxResult.error("修改任务失败,SQL异常报错:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务编号并构造Tm_Task任务对象
|
||||||
|
* @param purchaseCheckInfo 新购验收任务数据
|
||||||
|
* @param thisMonthMaxOrder 当月最大单号
|
||||||
|
* @return 任务对象
|
||||||
|
*/
|
||||||
|
private static TmTask genderTaskCode(PurchaseCheckDto purchaseCheckInfo, Integer thisMonthMaxOrder) {
|
||||||
|
String taskCode = TASK_TYPE_LABEL + DateUtils.getCurrentYear() + DateUtils.getCurrentMonth() + String.format("%06d", thisMonthMaxOrder + 1);
|
||||||
|
|
||||||
|
// 构造函数创建任务对象
|
||||||
|
return new TmTask(null,
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_NOTICE.getTaskTypeId(),
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_NOTICE.getTaskStatusValue(),
|
||||||
|
taskCode, purchaseCheckInfo.getPurchaseCheckInfo().getCompanyId(), "1", thisMonthMaxOrder + 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改新购验收任务
|
* 修改新购验收任务
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
package com.bonus.material.purchase.service.impl;
|
package com.bonus.material.purchase.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.sms.SmsUtils;
|
import com.bonus.common.core.utils.sms.SmsUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.purchase.config.PurchaseTaskEnum;
|
||||||
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
|
import com.bonus.material.purchase.dto.PurchaseNoticePersonDto;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.purchase.mapper.PurchaseNoticePersonMapper;
|
import com.bonus.material.purchase.mapper.PurchaseNoticePersonMapper;
|
||||||
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
|
import com.bonus.material.purchase.domain.PurchaseNoticePerson;
|
||||||
import com.bonus.material.purchase.service.IPurchaseNoticePersonService;
|
import com.bonus.material.purchase.service.IPurchaseNoticePersonService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
@ -26,6 +30,12 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
||||||
@Resource
|
@Resource
|
||||||
private PurchaseNoticePersonMapper purchaseNoticePersonMapper;
|
private PurchaseNoticePersonMapper purchaseNoticePersonMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TmTaskMapper tmTaskMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PurchaseCheckDetailsServiceImpl purchaseCheckDetailsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询新购短信通知人员
|
* 查询新购短信通知人员
|
||||||
*
|
*
|
||||||
|
|
@ -49,12 +59,32 @@ public class PurchaseNoticePersonServiceImpl implements IPurchaseNoticePersonSer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional
|
||||||
public AjaxResult batchSendSms(PurchaseNoticePersonDto purchaseNoticePersonDto) {
|
public AjaxResult batchSendSms(PurchaseNoticePersonDto purchaseNoticePersonDto) {
|
||||||
String splitPhoneNumber = String.join(",", purchaseNoticePersonDto.getPhoneNumbers());
|
String splitPhoneNumber = String.join(",", purchaseNoticePersonDto.getPhoneNumbers());
|
||||||
try {
|
try {
|
||||||
String sendResult = SmsUtils.smsToken(splitPhoneNumber, purchaseNoticePersonDto.getContent(), null);
|
String sendResult = SmsUtils.smsToken(splitPhoneNumber, purchaseNoticePersonDto.getContent(), null);
|
||||||
return AjaxResult.success(sendResult);
|
if (sendResult != null) {
|
||||||
|
// 发送短信后修改任务状态
|
||||||
|
tmTaskMapper.updateTmTask(new TmTask()
|
||||||
|
.setTaskId(purchaseNoticePersonDto.getTaskId())
|
||||||
|
.setTaskType(PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_CHECK.getTaskTypeId())
|
||||||
|
.setTaskStatus(PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_CHECK.getTaskStatusCode())
|
||||||
|
);
|
||||||
|
|
||||||
|
// 修改采购明细的任务状态
|
||||||
|
purchaseCheckDetailsService.batchUpdateDetailsTaskStatus(
|
||||||
|
purchaseNoticePersonDto.getTaskId(),
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_NOTICE.getTaskStatusCode(),
|
||||||
|
PurchaseTaskEnum.PURCHASE_TASK_STATUS_WAIT_CHECK.getTaskStatusCode()
|
||||||
|
);
|
||||||
|
|
||||||
|
return AjaxResult.success("短信发送成功:" + sendResult);
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("短信发送失败,发送结果为空");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
// 抛出异常,执行事务回滚
|
||||||
throw new RuntimeException("短信发送异常:" + e.getMessage());
|
throw new RuntimeException("短信发送异常:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务对象 tm_task
|
* 任务对象 tm_task
|
||||||
|
|
@ -14,6 +15,7 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@ToString
|
@ToString
|
||||||
|
@Accessors(chain = true)
|
||||||
public class TmTask extends BaseEntity {
|
public class TmTask extends BaseEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
@ -24,12 +26,12 @@ public class TmTask extends BaseEntity {
|
||||||
/** 任务类型(定义数据字典) */
|
/** 任务类型(定义数据字典) */
|
||||||
@Excel(name = "任务类型(定义数据字典)")
|
@Excel(name = "任务类型(定义数据字典)")
|
||||||
@ApiModelProperty(value = "任务类型(定义数据字典)")
|
@ApiModelProperty(value = "任务类型(定义数据字典)")
|
||||||
private Long taskType;
|
private Integer taskType;
|
||||||
|
|
||||||
/** 任务状态(定义数据字典) */
|
/** 任务状态(定义数据字典) */
|
||||||
@Excel(name = "任务状态(定义数据字典)")
|
@Excel(name = "任务状态(定义数据字典)")
|
||||||
@ApiModelProperty(value = "任务状态(定义数据字典)")
|
@ApiModelProperty(value = "任务状态(定义数据字典)")
|
||||||
private Long taskStatus;
|
private Integer taskStatus;
|
||||||
|
|
||||||
/** 编号 */
|
/** 编号 */
|
||||||
@Excel(name = "编号")
|
@Excel(name = "编号")
|
||||||
|
|
@ -49,7 +51,7 @@ public class TmTask extends BaseEntity {
|
||||||
@ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型")
|
@ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型")
|
||||||
private Integer monthOrder;
|
private Integer monthOrder;
|
||||||
|
|
||||||
public TmTask(Long taskId, Long taskType, Long taskStatus, String code, Long companyId, String status, Integer monthOrder) {
|
public TmTask(Long taskId, Integer taskType, Integer taskStatus, String code, Long companyId, String status, Integer monthOrder) {
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
this.taskType = taskType;
|
this.taskType = taskType;
|
||||||
this.taskStatus = taskStatus;
|
this.taskStatus = taskStatus;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,15 @@ public interface TmTaskMapper {
|
||||||
*/
|
*/
|
||||||
int updateTmTask(TmTask tmTask);
|
int updateTmTask(TmTask tmTask);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据任务id更新任务状态 -- 批量、限制状态
|
||||||
|
* @param taskId 任务id 必传
|
||||||
|
* @param oldTaskStatus 旧状态:限制条件、限制影响边界
|
||||||
|
* @param newTaskStatus 新状态
|
||||||
|
*/
|
||||||
|
int updateTmTaskStatusByTaskId(@Param("taskId") Long taskId, @Param("oldTaskStatus") Integer oldTaskStatus, @Param("newTaskStatus") Integer newTaskStatus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除任务
|
* 删除任务
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -201,4 +201,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
values(#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId},#{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum},#{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId})
|
values(#{item.taskId},#{item.typeId},#{item.purchasePrice},#{item.purchaseNum},#{item.checkNum},#{item.bindNum},#{item.checkResult},#{item.supplierId},#{item.status},#{item.productionTime},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.checkUrlName},#{item.checkUrl},#{item.inputNum},#{item.inputStatus},#{item.inputTime},#{item.fileName},#{item.fileUrl},#{item.companyId})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="batchUpdateDetailsTaskStatus" resultType="int">
|
||||||
|
update
|
||||||
|
purchase_check_details
|
||||||
|
set
|
||||||
|
`status` = #{newTaskStatus}
|
||||||
|
where
|
||||||
|
del_flag = '0'
|
||||||
|
and task_id = #{taskId}
|
||||||
|
and status = #{oldTaskStatus}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectPurchaseCheckFileListByTaskId" parameterType="Long" resultMap="PurchaseCheckFileResult">
|
<select id="selectPurchaseCheckFileListByTaskId" parameterType="Long" resultMap="PurchaseCheckFileResult">
|
||||||
<include refid="selectPurchaseCheckFileJoinVo"/>
|
<include refid="selectPurchaseCheckFileJoinVo"/>
|
||||||
and bfi.task_id = #{taskId}
|
and bfi.task_id = #{taskId}
|
||||||
|
and bfi.model_id = #{typeId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertPurchaseCheckFiles" parameterType="com.bonus.material.purchase.dto.PurchaseCheckFileDto" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertPurchaseCheckFiles" parameterType="com.bonus.material.purchase.dto.PurchaseCheckFileDto" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPurchaseMacodeInfoVo">
|
<sql id="selectPurchaseMacodeInfoVo">
|
||||||
select id, task_id, type_id, ma_code, qr_code, fix_code, code_type, status, create_by, create_time, update_by, update_time, remark, company_id from purchase_macode_info
|
select id, task_id, type_id, ma_code, qr_code, fix_code, code_type, status,
|
||||||
|
create_by, create_time, update_by, update_time, remark, company_id
|
||||||
|
from purchase_macode_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPurchaseMacodeInfoList" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo" resultMap="PurchaseMacodeInfoResult">
|
<select id="selectPurchaseMacodeInfoList" parameterType="com.bonus.material.purchase.domain.PurchaseMacodeInfo" resultMap="PurchaseMacodeInfoResult">
|
||||||
|
|
|
||||||
|
|
@ -108,4 +108,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and task_type = #{type}
|
and task_type = #{type}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateTmTaskStatusByTaskId">
|
||||||
|
update tm_task set task_status = #{newTaskStatus}
|
||||||
|
where task_id = #{taskId} and task_status = #{oldTaskStatus}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue