Merge remote-tracking branch 'origin/master'
commit
cb435dabe3
@ -0,0 +1,165 @@
|
|||||||
|
package com.glxp.api.controller.basic;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.stream.StreamUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.enums.ResultEnum;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.dao.basic.BasicHospTypeRelDao;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeEntity;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeRelEntity;
|
||||||
|
import com.glxp.api.entity.basic.UdiEntity;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.res.basic.BasicHospTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
import com.glxp.api.service.basic.BasicHospTypeRelService;
|
||||||
|
import com.glxp.api.service.basic.BasicHospTypeService;
|
||||||
|
import com.glxp.api.util.StreamUtils;
|
||||||
|
import com.glxp.api.util.StringUtils;
|
||||||
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class BasicHospTypeController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BasicHospTypeService basicHospTypeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BasicHospTypeRelService basicHospTypeRelService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/basic/hosp/type/filter")
|
||||||
|
public BaseResponse filterBasicUnitMaintain(BasicHospTypeFilterRequest basicHospTypeFilterRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
List<BasicHospTypeEntity> basicHospTypeEntities=basicHospTypeService.filterHospTypeList(basicHospTypeFilterRequest);
|
||||||
|
PageInfo<BasicHospTypeEntity> pageInfo = new PageInfo<>(basicHospTypeEntities);
|
||||||
|
PageSimpleResponse<BasicHospTypeEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(basicHospTypeEntities);
|
||||||
|
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/basic/hosp/type/menuList")
|
||||||
|
public BaseResponse menuList(BasicHospTypeFilterRequest basicHospTypeFilterRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
List<BasicHospTypeEntity> basicHospTypeEntities=basicHospTypeService.getMenuList(basicHospTypeFilterRequest);
|
||||||
|
|
||||||
|
return ResultVOUtils.success(basicHospTypeEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/basic/hosp/type/save")
|
||||||
|
public BaseResponse save(@RequestBody BasicHospTypeRequest basicHospTypeRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean falg=basicHospTypeService.saveBasicHospType(basicHospTypeRequest);
|
||||||
|
if(!falg){
|
||||||
|
return ResultVOUtils.error(999,"插入失败!");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/basic/hosp/type/update")
|
||||||
|
public BaseResponse update(@RequestBody BasicHospTypeRequest basicHospTypeRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean falg=basicHospTypeService.updateBasicHospType(basicHospTypeRequest);
|
||||||
|
if(!falg){
|
||||||
|
return ResultVOUtils.error(999,"更新失败!");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/basic/hosp/type/delect")
|
||||||
|
public BaseResponse delect(BasicHospTypeRequest basicHospTypeRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
String msg=basicHospTypeService.delectBasicHospType(basicHospTypeRequest);
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(msg)){
|
||||||
|
return ResultVOUtils.error(999,msg);
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/basic/hosp/type/getTree")
|
||||||
|
public BaseResponse getTree() {
|
||||||
|
List<BasicHospTypeResponse> basicHospTypeEntities=basicHospTypeService.getTreeList();
|
||||||
|
return ResultVOUtils.success(basicHospTypeEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/basic/hosp/type/bindRel")
|
||||||
|
public BaseResponse saveRel(@RequestBody BasicHospTypeRequest basicHospTypeRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean falg=basicHospTypeService.bindHospProduct(basicHospTypeRequest);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/basic/hosp/type/bindList")
|
||||||
|
public BaseResponse bindList(FilterUdiRelRequest filterUdiRelRequest) {
|
||||||
|
|
||||||
|
filterUdiRelRequest.setDiType(1);
|
||||||
|
List<UdiRelevanceResponse> udiRelevanceResponses = basicHospTypeService.filterUdiGp(filterUdiRelRequest);
|
||||||
|
//查询分类关联表,存在的制灰
|
||||||
|
List<BasicHospTypeRelEntity> basicHospTypeRelEntityList=basicHospTypeRelService.getBasicHospTypeRelList(filterUdiRelRequest.getBindId());
|
||||||
|
for (UdiRelevanceResponse obj:udiRelevanceResponses){
|
||||||
|
for (BasicHospTypeRelEntity obj2:basicHospTypeRelEntityList){
|
||||||
|
if(obj2.getRelId().equals(String.valueOf(obj.getId()))){
|
||||||
|
obj.setBindCheck(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PageInfo<UdiRelevanceResponse> pageInfo = new PageInfo<>(udiRelevanceResponses);
|
||||||
|
PageSimpleResponse<UdiRelevanceResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(udiRelevanceResponses);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/basic/hosp/type/unbindRel")
|
||||||
|
public BaseResponse unbindRel(@RequestBody BasicHospTypeRequest basicHospTypeRequest, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean falg=basicHospTypeService.unbindHospProduct(basicHospTypeRequest);
|
||||||
|
return ResultVOUtils.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.glxp.api.controller.inv;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindMsgResponse;
|
||||||
|
import com.glxp.api.service.inv.InvRemindMsgService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警消息接口
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class InvRemindMsgController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvRemindMsgService invRemindMsgService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警消息列表
|
||||||
|
*
|
||||||
|
* @param filterInvRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/udiwms/inv/remind/msg/filter")
|
||||||
|
public BaseResponse filterList(FilterInvRemindMsgRequest filterInvRemindMsgRequest) {
|
||||||
|
List<InvRemindMsgResponse> list = invRemindMsgService.filterList(filterInvRemindMsgRequest);
|
||||||
|
PageInfo<InvRemindMsgResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
return ResultVOUtils.page(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认预警消息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/udiwms/inv/remind/msg/confirmMsg")
|
||||||
|
public BaseResponse confirmMsg(Integer id, String handleMsg) {
|
||||||
|
return invRemindMsgService.confirmMsg(id, handleMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.glxp.api.controller.inv;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.enums.ResultEnum;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.req.inv.AddInvRemindSetRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindSetRequest;
|
||||||
|
import com.glxp.api.req.system.DeleteRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindSetResponse;
|
||||||
|
import com.glxp.api.service.inv.InvRemindSetService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警设置接口
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class InvRemindSetController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvRemindSetService invRemindSetService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库存预警设置列表
|
||||||
|
*
|
||||||
|
* @param filterInvRemindSetRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/udiwms/inv/remind/set/filter")
|
||||||
|
public BaseResponse filterList(FilterInvRemindSetRequest filterInvRemindSetRequest) {
|
||||||
|
List<InvRemindSetResponse> list = invRemindSetService.filterList(filterInvRemindSetRequest);
|
||||||
|
PageInfo<InvRemindSetResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
return ResultVOUtils.page(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加库存预警设置
|
||||||
|
*
|
||||||
|
* @param addInvRemindSetRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/udiwms/inv/remind/set/add")
|
||||||
|
public BaseResponse addInvRemindSet(@RequestBody AddInvRemindSetRequest addInvRemindSetRequest) {
|
||||||
|
return invRemindSetService.addInvRemindSet(addInvRemindSetRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新库存预警设置
|
||||||
|
*
|
||||||
|
* @param invRemindSetEntity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/udiwms/inv/remind/set/update")
|
||||||
|
public BaseResponse updateInvRemindSet(@RequestBody InvRemindSetEntity invRemindSetEntity) {
|
||||||
|
return invRemindSetService.updateInvRemindSet(invRemindSetEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除库存预警设置
|
||||||
|
*
|
||||||
|
* @param deleteRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/udiwms/inv/remind/set/delete")
|
||||||
|
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest) {
|
||||||
|
if (null == deleteRequest || StrUtil.isBlank(deleteRequest.getId())) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return invRemindSetService.deleteInvRemindSet(Integer.valueOf(deleteRequest.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
package com.glxp.api.dao.basic;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.glxp.api.entity.basic.BasicUdirelTypeEntity;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface BasicUdirelTypeDao extends BaseMapper<BasicUdirelTypeEntity> {
|
|
||||||
int updateBatch(List<BasicUdirelTypeEntity> list);
|
|
||||||
|
|
||||||
int updateBatchSelective(List<BasicUdirelTypeEntity> list);
|
|
||||||
|
|
||||||
int batchInsert(@Param("list") List<BasicUdirelTypeEntity> list);
|
|
||||||
|
|
||||||
int insertOrUpdate(BasicUdirelTypeEntity record);
|
|
||||||
|
|
||||||
int insertOrUpdateSelective(BasicUdirelTypeEntity record);
|
|
||||||
}
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.glxp.api.dao.inv;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindMsgEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindMsgResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警消息Dao
|
||||||
|
*/
|
||||||
|
public interface InvRemindMsgDao extends BaseMapper<InvRemindMsgEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库存预警消息列表
|
||||||
|
*
|
||||||
|
* @param filterInvRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<InvRemindMsgResponse> filterList(FilterInvRemindMsgRequest filterInvRemindMsgRequest);
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.glxp.api.dao.inv;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindSetRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindSetResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存设置Dao
|
||||||
|
*/
|
||||||
|
public interface InvRemindSetDao extends BaseMapper<InvRemindSetEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库存设置列表
|
||||||
|
*
|
||||||
|
* @param filterInvRemindSetRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<InvRemindSetResponse> filterList(FilterInvRemindSetRequest filterInvRemindSetRequest);
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.res.basic.BasicErpUnitsResponse;
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasicHospTypeFilterRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.basic.UdiProductEntity;
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasicHospTypeRequest{
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String code;
|
||||||
|
private String parentCode;
|
||||||
|
private String name;
|
||||||
|
private String remark;
|
||||||
|
List<String> ids;
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.glxp.api.req.inv;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加库存预警设置参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddInvRemindSetRequest {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 耗材字典主键
|
||||||
|
*/
|
||||||
|
private String relId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编码
|
||||||
|
*/
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库编码
|
||||||
|
*/
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位编码
|
||||||
|
*/
|
||||||
|
private String invSpaceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启低库存预警
|
||||||
|
*/
|
||||||
|
private Boolean lowStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存低于多少数量时预警
|
||||||
|
*/
|
||||||
|
private Integer lowStockNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启库存负数预警
|
||||||
|
*/
|
||||||
|
private Boolean lackStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启库存积压预警
|
||||||
|
*/
|
||||||
|
private Boolean overStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存高于多少数量时预警
|
||||||
|
*/
|
||||||
|
private Integer overStockNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启库存产品过期提醒
|
||||||
|
*/
|
||||||
|
private Boolean expireDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启近效期提醒
|
||||||
|
*/
|
||||||
|
private Boolean recentDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近效期达到多少天时提醒
|
||||||
|
*/
|
||||||
|
private Integer recentDateDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.glxp.api.req.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警设置查询参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FilterInvRemindSetRequest extends ListPageRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 耗材字典主键
|
||||||
|
*/
|
||||||
|
private String relId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库编码
|
||||||
|
*/
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位编码
|
||||||
|
*/
|
||||||
|
private String invSpaceCode;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.glxp.api.res.basic;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BasicHospTypeResponse {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String code;
|
||||||
|
private String parentCode;
|
||||||
|
private String name;
|
||||||
|
private String remark;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
private String createUser;
|
||||||
|
private String updateUser;
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,93 @@
|
|||||||
|
package com.glxp.api.res.inv;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存设置VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InvRemindSetResponse {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 耗材字典主键
|
||||||
|
*/
|
||||||
|
private String relId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门编码
|
||||||
|
*/
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库编码
|
||||||
|
*/
|
||||||
|
private String invCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位编码
|
||||||
|
*/
|
||||||
|
private String invSpaceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启低库存预警
|
||||||
|
*/
|
||||||
|
private Boolean lowStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存低于多少数量时预警
|
||||||
|
*/
|
||||||
|
private Integer lowStockNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启库存负数预警
|
||||||
|
*/
|
||||||
|
private Boolean lackStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启库存积压预警
|
||||||
|
*/
|
||||||
|
private Boolean overStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存高于多少数量时预警
|
||||||
|
*/
|
||||||
|
private Integer overStockNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启库存产品过期提醒
|
||||||
|
*/
|
||||||
|
private Boolean expireDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启近效期提醒
|
||||||
|
*/
|
||||||
|
private Boolean recentDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 近效期达到多少天时提醒
|
||||||
|
*/
|
||||||
|
private Integer recentDateDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库名称
|
||||||
|
*/
|
||||||
|
private String invName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 货位名称
|
||||||
|
*/
|
||||||
|
private String invSpaceName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeEntity;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeRelEntity;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||||
|
import com.glxp.api.res.basic.BasicHospTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BasicHospTypeRelService {
|
||||||
|
|
||||||
|
List<BasicHospTypeRelEntity> getBasicHospTypeRelList(String code);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeEntity;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||||
|
import com.glxp.api.res.basic.BasicHospTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BasicHospTypeService {
|
||||||
|
|
||||||
|
List<BasicHospTypeEntity> filterHospTypeList(BasicHospTypeFilterRequest basicHospTypeFilterRequest);
|
||||||
|
|
||||||
|
List<BasicHospTypeEntity> getMenuList(BasicHospTypeFilterRequest basicHospTypeFilterRequest);
|
||||||
|
|
||||||
|
Boolean saveBasicHospType(BasicHospTypeRequest basicHospTypeRequest);
|
||||||
|
|
||||||
|
boolean updateBasicHospType(BasicHospTypeRequest basicHospTypeRequest);
|
||||||
|
|
||||||
|
String delectBasicHospType(BasicHospTypeRequest basicHospTypeRequest);
|
||||||
|
|
||||||
|
List<BasicHospTypeResponse> getTreeList();
|
||||||
|
|
||||||
|
boolean bindHospProduct(BasicHospTypeRequest basicHospTypeRequest);
|
||||||
|
|
||||||
|
boolean unbindHospProduct(BasicHospTypeRequest basicHospTypeRequest);
|
||||||
|
|
||||||
|
List<UdiRelevanceResponse> filterUdiGp(FilterUdiRelRequest filterUdiRelRequest);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.glxp.api.service.basic.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.basic.BasicHospTypeDao;
|
||||||
|
import com.glxp.api.dao.basic.BasicHospTypeRelDao;
|
||||||
|
import com.glxp.api.dao.basic.UdiRelevanceDao;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeEntity;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeRelEntity;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||||
|
import com.glxp.api.res.basic.BasicHospTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.basic.BasicHospTypeRelService;
|
||||||
|
import com.glxp.api.service.basic.BasicHospTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BasicHospTypeRelServiceImpl implements BasicHospTypeRelService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BasicHospTypeRelDao basicHospTypeRelDao;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BasicHospTypeRelEntity> getBasicHospTypeRelList(String code) {
|
||||||
|
List<BasicHospTypeRelEntity> basicHospTypeRelEntityList=new ArrayList<>();
|
||||||
|
QueryWrapper<BasicHospTypeRelEntity> ew=new QueryWrapper<>();
|
||||||
|
if(StrUtil.isNotEmpty(code)){
|
||||||
|
ew.eq("code",code);
|
||||||
|
basicHospTypeRelEntityList =basicHospTypeRelDao.selectList(ew);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return basicHospTypeRelEntityList;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,178 @@
|
|||||||
|
package com.glxp.api.service.basic.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.basic.BasicHospTypeDao;
|
||||||
|
import com.glxp.api.dao.basic.BasicHospTypeRelDao;
|
||||||
|
import com.glxp.api.dao.basic.UdiRelevanceDao;
|
||||||
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeEntity;
|
||||||
|
import com.glxp.api.entity.basic.BasicHospTypeRelEntity;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeFilterRequest;
|
||||||
|
import com.glxp.api.req.basic.BasicHospTypeRequest;
|
||||||
|
import com.glxp.api.req.basic.FilterUdiRelRequest;
|
||||||
|
import com.glxp.api.res.basic.BasicHospTypeResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.basic.BasicHospTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BasicHospTypeServiceImpl implements BasicHospTypeService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BasicHospTypeDao basicHospTypeDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CustomerService customerService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
BasicHospTypeRelDao basicHospTypeRelDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
UdiRelevanceDao udiRelevanceDao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BasicHospTypeEntity> filterHospTypeList(BasicHospTypeFilterRequest basicHospTypeFilterRequest) {
|
||||||
|
if (basicHospTypeFilterRequest == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (basicHospTypeFilterRequest.getPage() != null) {
|
||||||
|
int offset = (basicHospTypeFilterRequest.getPage() - 1) * basicHospTypeFilterRequest.getLimit();
|
||||||
|
PageHelper.offsetPage(offset, basicHospTypeFilterRequest.getLimit());
|
||||||
|
}
|
||||||
|
QueryWrapper<BasicHospTypeEntity> ew=new QueryWrapper<>();
|
||||||
|
if (StrUtil.isNotEmpty(basicHospTypeFilterRequest.getName())){
|
||||||
|
ew.like("name",basicHospTypeFilterRequest.getName());
|
||||||
|
}
|
||||||
|
List<BasicHospTypeEntity> data = basicHospTypeDao.selectList(ew);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BasicHospTypeEntity> getMenuList(BasicHospTypeFilterRequest basicHospTypeFilterRequest) {
|
||||||
|
QueryWrapper<BasicHospTypeEntity> ew=new QueryWrapper<>();
|
||||||
|
List<BasicHospTypeEntity> data = basicHospTypeDao.selectList(ew);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean saveBasicHospType(BasicHospTypeRequest basicHospTypeRequest) {
|
||||||
|
boolean falg=true;
|
||||||
|
BasicHospTypeEntity basicHospTypeEntity=new BasicHospTypeEntity();
|
||||||
|
basicHospTypeEntity.setCreateTime(new Date());
|
||||||
|
basicHospTypeEntity.setUpdateTime(new Date());
|
||||||
|
basicHospTypeEntity.setName(basicHospTypeRequest.getName());
|
||||||
|
basicHospTypeEntity.setParentCode(basicHospTypeRequest.getParentCode());
|
||||||
|
basicHospTypeEntity.setRemark(basicHospTypeRequest.getRemark());
|
||||||
|
Long userId=customerService.getUserId();
|
||||||
|
basicHospTypeEntity.setCreateUser(userId+"");
|
||||||
|
basicHospTypeEntity.setUpdateUser(userId+"");
|
||||||
|
//获取数据库最大的code
|
||||||
|
QueryWrapper<BasicHospTypeEntity> ew=new QueryWrapper<>();
|
||||||
|
ew.select("max(code) as code");
|
||||||
|
BasicHospTypeEntity code=basicHospTypeDao.selectOne(ew);
|
||||||
|
basicHospTypeEntity.setCode(Integer.valueOf(code.getCode())+1+"");
|
||||||
|
int count=basicHospTypeDao.insert(basicHospTypeEntity);
|
||||||
|
if(count==0){
|
||||||
|
falg=false;
|
||||||
|
}
|
||||||
|
return falg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateBasicHospType(BasicHospTypeRequest basicHospTypeRequest) {
|
||||||
|
boolean falg=true;
|
||||||
|
BasicHospTypeEntity basicHospTypeEntity=new BasicHospTypeEntity();
|
||||||
|
basicHospTypeEntity.setId(basicHospTypeRequest.getId());
|
||||||
|
basicHospTypeEntity.setCreateTime(new Date());
|
||||||
|
basicHospTypeEntity.setUpdateTime(new Date());
|
||||||
|
basicHospTypeEntity.setName(basicHospTypeRequest.getName());
|
||||||
|
basicHospTypeEntity.setParentCode(basicHospTypeRequest.getParentCode());
|
||||||
|
basicHospTypeEntity.setRemark(basicHospTypeRequest.getRemark());
|
||||||
|
Long userId=customerService.getUserId();
|
||||||
|
basicHospTypeEntity.setCreateUser(userId+"");
|
||||||
|
basicHospTypeEntity.setUpdateUser(userId+"");
|
||||||
|
int count=basicHospTypeDao.updateById(basicHospTypeEntity);
|
||||||
|
if(count==0){
|
||||||
|
falg=false;
|
||||||
|
}
|
||||||
|
return falg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String delectBasicHospType(BasicHospTypeRequest basicHospTypeRequest) {
|
||||||
|
|
||||||
|
//查询有没有自己的子集
|
||||||
|
QueryWrapper<BasicHospTypeEntity> ew=new QueryWrapper<>();
|
||||||
|
ew.eq("parentCode",basicHospTypeRequest.getCode());
|
||||||
|
Long count=basicHospTypeDao.selectCount(ew);
|
||||||
|
if(count>0){
|
||||||
|
return "请先删除该节点底下的数据!";
|
||||||
|
}
|
||||||
|
//查询有没有产品绑定
|
||||||
|
QueryWrapper<BasicHospTypeRelEntity> ew2=new QueryWrapper<>();
|
||||||
|
ew2.eq("code",basicHospTypeRequest.getCode());
|
||||||
|
count=basicHospTypeRelDao.selectCount(ew2);
|
||||||
|
if(count>0){
|
||||||
|
return "该节点还存在产品,请先删除!";
|
||||||
|
}
|
||||||
|
|
||||||
|
basicHospTypeDao.deleteById(basicHospTypeRequest.getId());
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BasicHospTypeResponse> getTreeList() {
|
||||||
|
return basicHospTypeDao.getTreeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean bindHospProduct(BasicHospTypeRequest basicHospTypeRequest) {
|
||||||
|
|
||||||
|
List<BasicHospTypeRelEntity> basicHospTypeRelEntityList=new ArrayList<>();
|
||||||
|
for (String obj:basicHospTypeRequest.getIds()){
|
||||||
|
BasicHospTypeRelEntity basicHospTypeRelEntity=new BasicHospTypeRelEntity();
|
||||||
|
basicHospTypeRelEntity.setCode(basicHospTypeRequest.getCode());
|
||||||
|
basicHospTypeRelEntity.setRelId(obj);
|
||||||
|
basicHospTypeRelEntityList.add(basicHospTypeRelEntity);
|
||||||
|
}
|
||||||
|
basicHospTypeRelDao.batchInsert(basicHospTypeRelEntityList);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean unbindHospProduct(BasicHospTypeRequest basicHospTypeRequest) {
|
||||||
|
|
||||||
|
QueryWrapper<BasicHospTypeRelEntity> ew=new QueryWrapper<>();
|
||||||
|
ew.eq("code",basicHospTypeRequest.getCode());
|
||||||
|
ew.in("relId",basicHospTypeRequest.getIds());
|
||||||
|
basicHospTypeRelDao.delete(ew);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UdiRelevanceResponse> filterUdiGp(FilterUdiRelRequest filterUdiRelRequest) {
|
||||||
|
if (filterUdiRelRequest == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (filterUdiRelRequest.getPage() != null) {
|
||||||
|
int offset = (filterUdiRelRequest.getPage() - 1) * filterUdiRelRequest.getLimit();
|
||||||
|
PageHelper.offsetPage(offset, filterUdiRelRequest.getLimit());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UdiRelevanceResponse> data = udiRelevanceDao.filterUdiGp(filterUdiRelRequest);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.glxp.api.service.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindMsgResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警消息Servcie
|
||||||
|
*/
|
||||||
|
public interface InvRemindMsgService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库存预警消息列表
|
||||||
|
*
|
||||||
|
* @param filterInvRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<InvRemindMsgResponse> filterList(FilterInvRemindMsgRequest filterInvRemindMsgRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认消息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse confirmMsg(Integer id, String handleMsg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据库存预警设置生成预警消息
|
||||||
|
*
|
||||||
|
* @param invRemindSetEntity
|
||||||
|
*/
|
||||||
|
void createRemindMsg(InvRemindSetEntity invRemindSetEntity);
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.glxp.api.service.inv;
|
||||||
|
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.req.inv.AddInvRemindSetRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindSetRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindSetResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库存预警设置Service
|
||||||
|
*/
|
||||||
|
public interface InvRemindSetService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库存预警设置列表
|
||||||
|
*
|
||||||
|
* @param filterInvRemindSetRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<InvRemindSetResponse> filterList(FilterInvRemindSetRequest filterInvRemindSetRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加库存预警设置
|
||||||
|
*
|
||||||
|
* @param addInvRemindSetRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse addInvRemindSet(AddInvRemindSetRequest addInvRemindSetRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新库存预警设置
|
||||||
|
*
|
||||||
|
* @param invRemindSetEntity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse updateInvRemindSet(InvRemindSetEntity invRemindSetEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID删除库存预警设置
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse deleteInvRemindSet(Integer id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,115 @@
|
|||||||
|
package com.glxp.api.service.inv.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.common.enums.ResultEnum;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.dao.inv.InvProductDao;
|
||||||
|
import com.glxp.api.dao.inv.InvRemindMsgDao;
|
||||||
|
import com.glxp.api.entity.inv.InvProductEntity;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindMsgEntity;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindMsgResponse;
|
||||||
|
import com.glxp.api.service.inv.InvRemindMsgService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class InvRemindMsgServiceImpl implements InvRemindMsgService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvRemindMsgDao invRemindMsgDao;
|
||||||
|
@Resource
|
||||||
|
private InvProductDao invProductDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<InvRemindMsgResponse> filterList(FilterInvRemindMsgRequest filterInvRemindMsgRequest) {
|
||||||
|
if (null == filterInvRemindMsgRequest) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (null != filterInvRemindMsgRequest.getPage() && null != filterInvRemindMsgRequest.getLimit()) {
|
||||||
|
PageHelper.offsetPage((filterInvRemindMsgRequest.getPage() - 1) * filterInvRemindMsgRequest.getLimit(), filterInvRemindMsgRequest.getLimit());
|
||||||
|
}
|
||||||
|
return invRemindMsgDao.filterList(filterInvRemindMsgRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse confirmMsg(Integer id, String handleMsg) {
|
||||||
|
InvRemindMsgEntity invRemindMsgEntity = invRemindMsgDao.selectById(id);
|
||||||
|
if (null == invRemindMsgEntity) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "消息不存在");
|
||||||
|
}
|
||||||
|
invRemindMsgEntity.setStatus(2); //消息状态修改为已确认
|
||||||
|
invRemindMsgEntity.setIgnoreStatus(0); //重置成为不忽略
|
||||||
|
invRemindMsgEntity.setHandleMsg(handleMsg); //处理方式
|
||||||
|
invRemindMsgEntity.setUpdateTime(new Date());
|
||||||
|
invRemindMsgDao.updateById(invRemindMsgEntity);
|
||||||
|
return ResultVOUtils.success("已确认");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createRemindMsg(InvRemindSetEntity invRemindSetEntity) {
|
||||||
|
log.info("库存预警设置:{}", invRemindSetEntity.toString());
|
||||||
|
//查询库存数量
|
||||||
|
List<InvProductEntity> invProductList = invProductDao.selectInvProductInfo(invRemindSetEntity.getInvCode(), invRemindSetEntity.getInvSpaceCode(), invRemindSetEntity.getRelId());
|
||||||
|
if (CollUtil.isNotEmpty(invProductList)) {
|
||||||
|
List<InvProductEntity> invDataList = new CopyOnWriteArrayList<>(invProductList);
|
||||||
|
|
||||||
|
invDataList.parallelStream().forEach(invProductEntity -> {
|
||||||
|
QueryWrapper<InvRemindMsgEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(invRemindSetEntity.getRelId()), "relId", invRemindSetEntity.getRelId())
|
||||||
|
.eq("invCode", invRemindSetEntity.getInvCode())
|
||||||
|
.eq(StrUtil.isNotBlank(invRemindSetEntity.getInvSpaceCode()), "invSpaceCode", invRemindSetEntity.getInvSpaceCode());
|
||||||
|
InvRemindMsgEntity invRemindMsgEntity = invRemindMsgDao.selectOne(wrapper);
|
||||||
|
if (null == invRemindMsgEntity) {
|
||||||
|
invRemindMsgEntity = new InvRemindMsgEntity();
|
||||||
|
invRemindMsgEntity.setCreateTime(new Date());
|
||||||
|
invRemindMsgEntity.setInvCode(invRemindSetEntity.getInvCode());
|
||||||
|
invRemindMsgEntity.setInvSpaceCode(invRemindSetEntity.getInvSpaceCode());
|
||||||
|
if (StrUtil.isBlank(invRemindSetEntity.getRelId())) {
|
||||||
|
//按照产品统计
|
||||||
|
invRemindMsgEntity.setRelId(invRemindSetEntity.getRelId());
|
||||||
|
} else {
|
||||||
|
//按仓库统计
|
||||||
|
//TODO 待完善
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成或更新预警消息标识
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
StringBuffer msg = new StringBuffer();
|
||||||
|
|
||||||
|
//根据库存信息设置,计算或升成库存预警
|
||||||
|
if (invRemindSetEntity.getLowStock()) {
|
||||||
|
//开启低库存预警
|
||||||
|
if (invProductEntity.getReCount() < invRemindSetEntity.getLowStockNum()) {
|
||||||
|
invRemindMsgEntity.setReCount(invRemindMsgEntity.getReCount());
|
||||||
|
invRemindMsgEntity.setInCount(invProductEntity.getInCount());
|
||||||
|
invRemindMsgEntity.setOutCount(invProductEntity.getOutCount());
|
||||||
|
//invRemindMsgEntity.set
|
||||||
|
msg.append("库存过低,当前库存数量:").append(invProductEntity.getReCount()).append("\n");
|
||||||
|
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
log.info("此仓库或产品库存信息不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package com.glxp.api.service.inv.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.common.enums.ResultEnum;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.dao.inv.InvRemindSetDao;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.req.inv.AddInvRemindSetRequest;
|
||||||
|
import com.glxp.api.req.inv.FilterInvRemindSetRequest;
|
||||||
|
import com.glxp.api.res.inv.InvRemindSetResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.inv.InvRemindSetService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class InvRemindSetServiceImpl implements InvRemindSetService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private InvRemindSetDao invRemindSetDao;
|
||||||
|
@Resource
|
||||||
|
private CustomerService customerService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<InvRemindSetResponse> filterList(FilterInvRemindSetRequest filterInvRemindSetRequest) {
|
||||||
|
if (null == filterInvRemindSetRequest) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if (null != filterInvRemindSetRequest.getPage() && null != filterInvRemindSetRequest.getLimit()) {
|
||||||
|
PageHelper.offsetPage((filterInvRemindSetRequest.getPage() - 1) * filterInvRemindSetRequest.getLimit(), filterInvRemindSetRequest.getLimit());
|
||||||
|
}
|
||||||
|
return invRemindSetDao.filterList(filterInvRemindSetRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse addInvRemindSet(AddInvRemindSetRequest addInvRemindSetRequest) {
|
||||||
|
if (StrUtil.isBlank(addInvRemindSetRequest.getRelId()) || StrUtil.isBlank(addInvRemindSetRequest.getInvCode())) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "产品库存信息不完整!");
|
||||||
|
}
|
||||||
|
if (false == addInvRemindSetRequest.getLowStock() && false == addInvRemindSetRequest.getLackStock() && false == addInvRemindSetRequest.getOverStock() && false == addInvRemindSetRequest.getExpireDate() && false == addInvRemindSetRequest.getRecentDate()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "预警设置至少开启一项预警!");
|
||||||
|
}
|
||||||
|
InvRemindSetEntity invRemindSetEntity = new InvRemindSetEntity();
|
||||||
|
BeanUtil.copyProperties(addInvRemindSetRequest, invRemindSetEntity);
|
||||||
|
setUpdateInfo(invRemindSetEntity);
|
||||||
|
invRemindSetDao.insert(invRemindSetEntity);
|
||||||
|
return ResultVOUtils.success("添加成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse updateInvRemindSet(InvRemindSetEntity invRemindSetEntity) {
|
||||||
|
if (false == invRemindSetEntity.getLowStock() && false == invRemindSetEntity.getLackStock() && false == invRemindSetEntity.getOverStock() && false == invRemindSetEntity.getExpireDate() && false == invRemindSetEntity.getRecentDate()) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "预警设置至少开启一项预警!");
|
||||||
|
}
|
||||||
|
setUpdateInfo(invRemindSetEntity);
|
||||||
|
invRemindSetDao.updateById(invRemindSetEntity);
|
||||||
|
return ResultVOUtils.success("更新成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseResponse deleteInvRemindSet(Integer id) {
|
||||||
|
if (null == id) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
invRemindSetDao.deleteById(id);
|
||||||
|
return ResultVOUtils.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置创建更新信息
|
||||||
|
*
|
||||||
|
* @param invRemindSetEntity
|
||||||
|
*/
|
||||||
|
private void setUpdateInfo(InvRemindSetEntity invRemindSetEntity) {
|
||||||
|
Date date = new Date();
|
||||||
|
String userId = customerService.getUserIdStr();
|
||||||
|
if (null == invRemindSetEntity.getId()) {
|
||||||
|
invRemindSetEntity.setCreateUser(userId);
|
||||||
|
invRemindSetEntity.setCreateTime(date);
|
||||||
|
}
|
||||||
|
invRemindSetEntity.setUpdateUser(userId);
|
||||||
|
invRemindSetEntity.setUpdateTime(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.glxp.api.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import com.glxp.api.dao.inv.InvRemindSetDao;
|
||||||
|
import com.glxp.api.dao.schedule.ScheduledDao;
|
||||||
|
import com.glxp.api.entity.inv.InvRemindSetEntity;
|
||||||
|
import com.glxp.api.entity.system.ScheduledEntity;
|
||||||
|
import com.glxp.api.req.system.ScheduledRequest;
|
||||||
|
import com.glxp.api.service.inv.InvRemindMsgService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||||
|
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||||
|
import org.springframework.scheduling.support.CronTrigger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class InvRemindMsgTask implements SchedulingConfigurer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScheduledDao scheduledDao;
|
||||||
|
@Resource
|
||||||
|
private InvRemindMsgService invRemindMsgService;
|
||||||
|
@Resource
|
||||||
|
private InvRemindSetDao invRemindSetDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||||
|
taskRegistrar.addTriggerTask(this::process, triggerContext -> {
|
||||||
|
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||||
|
scheduledRequest.setCronName("invRemindMsgTask");
|
||||||
|
ScheduledEntity scheduled = scheduledDao.findScheduled(scheduledRequest);
|
||||||
|
if (null == scheduled) {
|
||||||
|
log.error("库存预警定时任务未配置,请注意!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String cron = scheduled.getCron();
|
||||||
|
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void process() {
|
||||||
|
log.info("开始扫描库存信息,生成库存预警消息");
|
||||||
|
List<InvRemindSetEntity> invRemindSetEntities = invRemindSetDao.selectList(null);
|
||||||
|
if (CollUtil.isNotEmpty(invRemindSetEntities)) {
|
||||||
|
log.info("库存预警设置条数:{}", invRemindSetEntities.size());
|
||||||
|
//开始生成库存信息
|
||||||
|
for (InvRemindSetEntity invRemindSetEntity : invRemindSetEntities) {
|
||||||
|
ThreadUtil.execAsync(ThreadUtil.newThread(() -> invRemindMsgService.createRemindMsg(invRemindSetEntity), "createInvRemindThread"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.info("无库存预警设置,结束库存扫描");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,261 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.glxp.api.dao.basic.BasicUdirelTypeDao">
|
|
||||||
<resultMap id="BaseResultMap" type="com.glxp.api.entity.basic.BasicUdirelTypeEntity">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
<!--@Table basic_udirel_type-->
|
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
|
||||||
<result column="pId" jdbcType="INTEGER" property="pId" />
|
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
|
||||||
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
|
||||||
<result column="updateTime" jdbcType="VARCHAR" property="updateTime" />
|
|
||||||
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
|
|
||||||
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
id, pId, `name`, remark, createTime, updateTime, `createUser`, updateUser
|
|
||||||
</sql>
|
|
||||||
<update id="updateBatch" parameterType="java.util.List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
update basic_udirel_type
|
|
||||||
<trim prefix="set" suffixOverrides=",">
|
|
||||||
<trim prefix="pId = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pId,jdbcType=INTEGER}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="`name` = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="remark = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="createTime = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="updateTime = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=VARCHAR}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="`createUser` = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createUser,jdbcType=VARCHAR}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="updateUser = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateUser,jdbcType=VARCHAR}
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</trim>
|
|
||||||
where id in
|
|
||||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
||||||
#{item.id,jdbcType=INTEGER}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
update basic_udirel_type
|
|
||||||
<trim prefix="set" suffixOverrides=",">
|
|
||||||
<trim prefix="pId = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.pId != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.pId,jdbcType=INTEGER}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="`name` = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.name != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="remark = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.remark != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="createTime = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.createTime != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="updateTime = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.updateTime != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="`createUser` = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.createUser != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createUser,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="updateUser = case" suffix="end,">
|
|
||||||
<foreach collection="list" index="index" item="item">
|
|
||||||
<if test="item.updateUser != null">
|
|
||||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateUser,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
</foreach>
|
|
||||||
</trim>
|
|
||||||
</trim>
|
|
||||||
where id in
|
|
||||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
||||||
#{item.id,jdbcType=INTEGER}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
insert into basic_udirel_type
|
|
||||||
(pId, `name`, remark, createTime, updateTime, `createUser`, updateUser)
|
|
||||||
values
|
|
||||||
<foreach collection="list" item="item" separator=",">
|
|
||||||
(#{item.pId,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR}, #{item.remark,jdbcType=VARCHAR},
|
|
||||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR},
|
|
||||||
#{item.updateUser,jdbcType=VARCHAR})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.basic.BasicUdirelTypeEntity" useGeneratedKeys="true">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
insert into basic_udirel_type
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
pId,
|
|
||||||
`name`,
|
|
||||||
remark,
|
|
||||||
createTime,
|
|
||||||
updateTime,
|
|
||||||
`createUser`,
|
|
||||||
updateUser,
|
|
||||||
</trim>
|
|
||||||
values
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
#{pId,jdbcType=INTEGER},
|
|
||||||
#{name,jdbcType=VARCHAR},
|
|
||||||
#{remark,jdbcType=VARCHAR},
|
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
|
||||||
#{updateTime,jdbcType=VARCHAR},
|
|
||||||
#{createUser,jdbcType=VARCHAR},
|
|
||||||
#{updateUser,jdbcType=VARCHAR},
|
|
||||||
</trim>
|
|
||||||
on duplicate key update
|
|
||||||
<trim suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id = #{id,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
pId = #{pId,jdbcType=INTEGER},
|
|
||||||
`name` = #{name,jdbcType=VARCHAR},
|
|
||||||
remark = #{remark,jdbcType=VARCHAR},
|
|
||||||
createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
||||||
updateTime = #{updateTime,jdbcType=VARCHAR},
|
|
||||||
`createUser` = #{createUser,jdbcType=VARCHAR},
|
|
||||||
updateUser = #{updateUser,jdbcType=VARCHAR},
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.glxp.api.entity.basic.BasicUdirelTypeEntity" useGeneratedKeys="true">
|
|
||||||
<!--@mbg.generated-->
|
|
||||||
insert into basic_udirel_type
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="pId != null">
|
|
||||||
pId,
|
|
||||||
</if>
|
|
||||||
<if test="name != null">
|
|
||||||
`name`,
|
|
||||||
</if>
|
|
||||||
<if test="remark != null">
|
|
||||||
remark,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
createTime,
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
updateTime,
|
|
||||||
</if>
|
|
||||||
<if test="createUser != null">
|
|
||||||
`createUser`,
|
|
||||||
</if>
|
|
||||||
<if test="updateUser != null">
|
|
||||||
updateUser,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
values
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="pId != null">
|
|
||||||
#{pId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="name != null">
|
|
||||||
#{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="remark != null">
|
|
||||||
#{remark,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
#{updateTime,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createUser != null">
|
|
||||||
#{createUser,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateUser != null">
|
|
||||||
#{updateUser,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
on duplicate key update
|
|
||||||
<trim suffixOverrides=",">
|
|
||||||
<if test="id != null">
|
|
||||||
id = #{id,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="pId != null">
|
|
||||||
pId = #{pId,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="name != null">
|
|
||||||
`name` = #{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="remark != null">
|
|
||||||
remark = #{remark,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
createTime = #{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
updateTime = #{updateTime,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createUser != null">
|
|
||||||
`createUser` = #{createUser,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateUser != null">
|
|
||||||
updateUser = #{updateUser,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
</mapper>
|
|
@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.glxp.api.dao.inv.InvRemindMsgDao">
|
||||||
|
<select id="filterList" resultType="com.glxp.api.res.inv.InvRemindMsgResponse">
|
||||||
|
select irm.id,
|
||||||
|
irm.relId,
|
||||||
|
irm.batchNo,
|
||||||
|
irm.productionDate,
|
||||||
|
irm.expireDate,
|
||||||
|
irm.deptCode,
|
||||||
|
irm.invCode,
|
||||||
|
irm.invSpaceCode,
|
||||||
|
irm.inCount,
|
||||||
|
irm.outCount,
|
||||||
|
irm.reCount,
|
||||||
|
irm.status,
|
||||||
|
irm.type,
|
||||||
|
irm.remark,
|
||||||
|
bp.cpmctymc productName,
|
||||||
|
(select `name` from auth_warehouse where `code` = irm.invCode) invName,
|
||||||
|
(select `name` from auth_space where `code` = irm.invSpaceCode and invCode = irm.invCode) invSpaceName
|
||||||
|
from inv_remind_msg irm
|
||||||
|
left join basic_udirel bu on bu.id = irm.relId
|
||||||
|
left join basic_products bp on bp.uuid = bu.uuid
|
||||||
|
<where>
|
||||||
|
<if test="relId != null and relId != ''">
|
||||||
|
AND irm.relId = #{relId}
|
||||||
|
</if>
|
||||||
|
<if test="batchNo != null and batchNo != ''">
|
||||||
|
AND irm.batchNo like concat('%', #{batchNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="invCode != null and invCode != ''">
|
||||||
|
AND irm.invCode = #{invCode}
|
||||||
|
</if>
|
||||||
|
<if test="invSpaceCode != null and invSpaceCode != ''">
|
||||||
|
AND irm.invSpaceCode = #{invSpaceCode}
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND irm.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND type = #{type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by irm.updateTime desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.glxp.api.dao.inv.InvRemindSetDao">
|
||||||
|
<select id="filterList" resultType="com.glxp.api.res.inv.InvRemindSetResponse">
|
||||||
|
select irs.id,
|
||||||
|
irs.relId,
|
||||||
|
irs.deptCode,
|
||||||
|
irs.invCode,
|
||||||
|
irs.invSpaceCode,
|
||||||
|
irs.lowStock,
|
||||||
|
irs.lowStockNum,
|
||||||
|
irs.lackStock,
|
||||||
|
irs.overStock,
|
||||||
|
irs.overStockNum,
|
||||||
|
irs.expireDate,
|
||||||
|
irs.recentDate,
|
||||||
|
irs.recentDateDay,
|
||||||
|
irs.remark,
|
||||||
|
bp.cpmctymc productName,
|
||||||
|
(select `name` from auth_warehouse where `code` = irs.invCode) invName,
|
||||||
|
(select `name` from auth_space where `code` = irs.invSpaceCode and invCode = irs.invCode) invSpaceName
|
||||||
|
from inv_remind_set irs
|
||||||
|
left join basic_udirel bu on bu.id = irs.relId
|
||||||
|
left join basic_products bp on bp.uuid = bu.uuid
|
||||||
|
<where>
|
||||||
|
<if test="relId != null and relId != ''">
|
||||||
|
AND irs.relId = #{relId}
|
||||||
|
</if>
|
||||||
|
<if test="invCode != null and invCode != ''">
|
||||||
|
AND irs.invCode = #{invCode}
|
||||||
|
</if>
|
||||||
|
<if test="invSpaceCode != null and invSpaceCode != ''">
|
||||||
|
AND irs.invSpaceCode = #{invSpaceCode}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by irs.updateTime desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue