Commit a9c7892db3bed3ca58ea8ed3ec44adfdbf332093
Merge remote-tracking branch 'origin/master_0929' into master_0929
Showing
22 changed files
with
765 additions
and
7 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/shipments/car/GetCarRequestPlanBo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.bo.shipments.car; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | +import com.lframework.starter.common.constants.StringPool; | |
| 5 | +import com.lframework.starter.web.core.bo.BaseBo; | |
| 6 | +import java.time.LocalDate; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +import com.lframework.xingyun.sc.entity.CarRequestPlan; | |
| 10 | +import com.lframework.xingyun.sc.entity.RequestCarTicket; | |
| 11 | +import io.swagger.annotations.ApiModelProperty; | |
| 12 | + | |
| 13 | +import lombok.Data; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * <p> | |
| 17 | + * 要车计划表 GetBo | |
| 18 | + * </p> | |
| 19 | + * | |
| 20 | + */ | |
| 21 | +@Data | |
| 22 | +public class GetCarRequestPlanBo extends BaseBo<CarRequestPlan> { | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * ID | |
| 26 | + */ | |
| 27 | + @ApiModelProperty("ID") | |
| 28 | + private String id; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 要车日期 | |
| 32 | + */ | |
| 33 | + @ApiModelProperty("要车日期") | |
| 34 | + @JsonFormat(pattern = StringPool.DATE_PATTERN) | |
| 35 | + private LocalDate requestCarData; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 装货厂别ID | |
| 39 | + */ | |
| 40 | + @ApiModelProperty("装货厂别ID") | |
| 41 | + private String workshopId; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 装货厂别 | |
| 45 | + */ | |
| 46 | + @ApiModelProperty("装货厂别") | |
| 47 | + private String workshopName; | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 备注 | |
| 51 | + */ | |
| 52 | + @ApiModelProperty("备注") | |
| 53 | + private String remarks; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 要车单 | |
| 57 | + */ | |
| 58 | + @ApiModelProperty("要车单") | |
| 59 | + private List<RequestCarTicket> requestCarTicketList; | |
| 60 | + | |
| 61 | + public GetCarRequestPlanBo() { | |
| 62 | + | |
| 63 | + } | |
| 64 | + | |
| 65 | + public GetCarRequestPlanBo(CarRequestPlan dto) { | |
| 66 | + | |
| 67 | + super(dto); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public BaseBo<CarRequestPlan> convert(CarRequestPlan dto) { | |
| 72 | + return super.convert(dto); | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + protected void afterInit(CarRequestPlan dto) { | |
| 77 | + | |
| 78 | + } | |
| 79 | +} | ... | ... |
| ... | ... | @@ -26,6 +26,12 @@ public class GetRequestCarTicketBo extends BaseBo<RequestCarTicket> { |
| 26 | 26 | private String id; |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | + * 要车计划ID | |
| 30 | + */ | |
| 31 | + @ApiModelProperty("要车计划ID") | |
| 32 | + private String planId; | |
| 33 | + | |
| 34 | + /** | |
| 29 | 35 | * 草稿要车单ID |
| 30 | 36 | */ |
| 31 | 37 | @ApiModelProperty("草稿要车单ID") | ... | ... |
| ... | ... | @@ -60,7 +60,6 @@ public class CustomerCreditHistoryController extends DefaultBaseController { |
| 60 | 60 | * 查询列表 |
| 61 | 61 | */ |
| 62 | 62 | @ApiOperation("查询列表") |
| 63 | - @HasPermission({"customerCreditHistory:customercredithistory:query"}) | |
| 64 | 63 | @GetMapping("/query") |
| 65 | 64 | public InvokeResult<PageResult<GetCustomerCreditHistoryBo>> query(@Valid QueryCustomerCreditHistoryVo vo) { |
| 66 | 65 | |
| ... | ... | @@ -80,7 +79,6 @@ public class CustomerCreditHistoryController extends DefaultBaseController { |
| 80 | 79 | * 查询列表 |
| 81 | 80 | */ |
| 82 | 81 | @ApiOperation("查询列表") |
| 83 | - @HasPermission({"customerCreditHistory:customercredithistory:query"}) | |
| 84 | 82 | @GetMapping("/customerCreditHistoryList") |
| 85 | 83 | public InvokeResult<List<GetCustomerCreditHistoryBo>> customerCreditHistoryList(@Valid QueryCustomerCreditHistoryVo vo) { |
| 86 | 84 | vo.setType("PART"); |
| ... | ... | @@ -126,7 +124,6 @@ public class CustomerCreditHistoryController extends DefaultBaseController { |
| 126 | 124 | * 查询列表 |
| 127 | 125 | */ |
| 128 | 126 | @ApiOperation("查询列表") |
| 129 | - @HasPermission({"customerCreditHistory:customercredithistory:query"}) | |
| 130 | 127 | @GetMapping("/examineCustomerCreditHistoryList") |
| 131 | 128 | public InvokeResult<List<GetCustomerCreditHistoryBo>> examineCustomerCreditHistoryList(@Valid QueryCustomerCreditHistoryVo vo) { |
| 132 | 129 | vo.setType("PART"); |
| ... | ... | @@ -156,7 +153,6 @@ public class CustomerCreditHistoryController extends DefaultBaseController { |
| 156 | 153 | */ |
| 157 | 154 | @ApiOperation("根据ID查询变更记录") |
| 158 | 155 | @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) |
| 159 | - @HasPermission({"customerCreditHistory:customercredithistory:query"}) | |
| 160 | 156 | @GetMapping("/getById") |
| 161 | 157 | public InvokeResult<ChangeData> get(@NotBlank(message = "id不能为空!") String id) { |
| 162 | 158 | |
| ... | ... | @@ -204,7 +200,6 @@ public class CustomerCreditHistoryController extends DefaultBaseController { |
| 204 | 200 | * 新增 |
| 205 | 201 | */ |
| 206 | 202 | @ApiOperation("新增") |
| 207 | - @HasPermission({"customerCreditHistory:customercredithistory:add"}) | |
| 208 | 203 | @PostMapping |
| 209 | 204 | public InvokeResult<Void> create(@Valid CreateCustomerCreditHistoryVo vo) { |
| 210 | 205 | |
| ... | ... | @@ -218,7 +213,6 @@ public class CustomerCreditHistoryController extends DefaultBaseController { |
| 218 | 213 | */ |
| 219 | 214 | @ApiOperation("根据ID删除") |
| 220 | 215 | @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) |
| 221 | - @HasPermission({"customerCreditHistory:customercredithistory:delete"}) | |
| 222 | 216 | @DeleteMapping |
| 223 | 217 | public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { |
| 224 | 218 | ... | ... |
| 1 | +package com.lframework.xingyun.sc.controller.shipments.car; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.annotations.security.HasPermission; | |
| 4 | +import com.lframework.starter.web.core.controller.DefaultBaseController; | |
| 5 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 6 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 7 | +import com.lframework.starter.web.core.components.resp.InvokeResult; | |
| 8 | +import javax.validation.constraints.NotBlank; | |
| 9 | +import com.lframework.xingyun.sc.bo.shipments.car.GetCarRequestPlanBo; | |
| 10 | +import com.lframework.xingyun.sc.entity.CarRequestPlan; | |
| 11 | +import com.lframework.xingyun.sc.entity.RequestCarTicket; | |
| 12 | +import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; | |
| 13 | +import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService; | |
| 14 | +import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo; | |
| 15 | +import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; | |
| 16 | +import com.lframework.xingyun.sc.vo.shipments.car.QueryRequestCarTicketVo; | |
| 17 | +import com.lframework.xingyun.sc.vo.shipments.car.UpdateCarRequestPlanVo; | |
| 18 | +import io.swagger.annotations.ApiImplicitParam; | |
| 19 | +import com.lframework.starter.web.core.components.resp.InvokeResultBuilder; | |
| 20 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 21 | +import io.swagger.annotations.ApiOperation; | |
| 22 | +import com.lframework.starter.common.utils.CollectionUtil; | |
| 23 | +import io.swagger.annotations.Api; | |
| 24 | +import org.springframework.web.bind.annotation.DeleteMapping; | |
| 25 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 26 | +import org.springframework.validation.annotation.Validated; | |
| 27 | +import org.springframework.web.bind.annotation.*; | |
| 28 | + | |
| 29 | +import javax.validation.Valid; | |
| 30 | +import java.util.List; | |
| 31 | +import java.util.stream.Collectors; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * 要车计划表 Controller | |
| 35 | + * | |
| 36 | + */ | |
| 37 | +@Api(tags = "要车计划表") | |
| 38 | +@Validated | |
| 39 | +@RestController | |
| 40 | +@RequestMapping("/carRequestPlan") | |
| 41 | +public class CarRequestPlanController extends DefaultBaseController { | |
| 42 | + | |
| 43 | + @Autowired | |
| 44 | + private CarRequestPlanService carRequestPlanService; | |
| 45 | + @Autowired | |
| 46 | + private RequestCarTicketService requestCarTicketService; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 查询列表 | |
| 50 | + */ | |
| 51 | + @ApiOperation("查询列表") | |
| 52 | + @HasPermission({"carRequestPlan:carrequestplan:query"}) | |
| 53 | + @GetMapping("/query") | |
| 54 | + public InvokeResult<PageResult<GetCarRequestPlanBo>> query(@Valid QueryCarRequestPlanVo vo) { | |
| 55 | + | |
| 56 | + PageResult<CarRequestPlan> pageResult = carRequestPlanService.query(getPageIndex(vo), getPageSize(vo), vo); | |
| 57 | + | |
| 58 | + List<CarRequestPlan> datas = pageResult.getDatas(); | |
| 59 | + List<GetCarRequestPlanBo> results = null; | |
| 60 | + | |
| 61 | + if (!CollectionUtil.isEmpty(datas)) { | |
| 62 | + results = datas.stream().map(GetCarRequestPlanBo::new).collect(Collectors.toList()); | |
| 63 | + } | |
| 64 | + | |
| 65 | + return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 根据ID查询 | |
| 70 | + */ | |
| 71 | + @ApiOperation("根据ID查询") | |
| 72 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 73 | + @HasPermission({"carRequestPlan:carrequestplan:query"}) | |
| 74 | + @GetMapping | |
| 75 | + public InvokeResult<GetCarRequestPlanBo> get(@NotBlank(message = "id不能为空!") String id) { | |
| 76 | + | |
| 77 | + CarRequestPlan data = carRequestPlanService.findById(id); | |
| 78 | + if (data == null) { | |
| 79 | + throw new DefaultClientException("要车计划不存在!"); | |
| 80 | + } | |
| 81 | + | |
| 82 | + GetCarRequestPlanBo result = new GetCarRequestPlanBo(data); | |
| 83 | + QueryRequestCarTicketVo vo = new QueryRequestCarTicketVo(); | |
| 84 | + vo.setPlanId(id); | |
| 85 | + List<RequestCarTicket> requestCarTicketList = requestCarTicketService.query(vo); | |
| 86 | + result.setRequestCarTicketList(requestCarTicketList); | |
| 87 | + | |
| 88 | + return InvokeResultBuilder.success(result); | |
| 89 | + } | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 新增 | |
| 93 | + */ | |
| 94 | + @ApiOperation("新增") | |
| 95 | + @HasPermission({"carRequestPlan:carrequestplan:add"}) | |
| 96 | + @PostMapping | |
| 97 | + public InvokeResult<Void> create(@Valid CreateCarRequestPlanVo vo) { | |
| 98 | + | |
| 99 | + carRequestPlanService.create(vo); | |
| 100 | + | |
| 101 | + return InvokeResultBuilder.success(); | |
| 102 | + } | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * 修改 | |
| 106 | + */ | |
| 107 | + @ApiOperation("修改") | |
| 108 | + @HasPermission({"carRequestPlan:carrequestplan:modify"}) | |
| 109 | + @PutMapping | |
| 110 | + public InvokeResult<Void> update(@Valid UpdateCarRequestPlanVo vo) { | |
| 111 | + | |
| 112 | + carRequestPlanService.update(vo); | |
| 113 | + | |
| 114 | + return InvokeResultBuilder.success(); | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * 根据ID删除 | |
| 119 | + */ | |
| 120 | + @ApiOperation("根据ID删除") | |
| 121 | + @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) | |
| 122 | + @HasPermission({"carRequestPlan:carrequestplan:delete"}) | |
| 123 | + @DeleteMapping | |
| 124 | + public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { | |
| 125 | + | |
| 126 | + carRequestPlanService.deleteById(id); | |
| 127 | + | |
| 128 | + return InvokeResultBuilder.success(); | |
| 129 | + } | |
| 130 | +} | ... | ... |
| 1 | +package com.lframework.xingyun.sc.entity; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 4 | +import com.lframework.starter.web.core.dto.BaseDto; | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +import com.baomidou.mybatisplus.annotation.FieldFill; | |
| 10 | +import com.lframework.starter.web.core.entity.BaseEntity; | |
| 11 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 12 | +import io.swagger.annotations.ApiModelProperty; | |
| 13 | +import lombok.Data; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * <p> | |
| 17 | + * 要车计划表 | |
| 18 | + * </p> | |
| 19 | + * | |
| 20 | + */ | |
| 21 | +@Data | |
| 22 | +@TableName("car_request_plan") | |
| 23 | +public class CarRequestPlan extends BaseEntity implements BaseDto { | |
| 24 | + | |
| 25 | + private static final long serialVersionUID = 1L; | |
| 26 | + | |
| 27 | + public static final String CACHE_NAME = "CarRequestPlan"; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * ID | |
| 31 | + */ | |
| 32 | + private String id; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 要车日期 | |
| 36 | + */ | |
| 37 | + private LocalDate requestCarData; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 装货厂别ID | |
| 41 | + */ | |
| 42 | + private String workshopId; | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 装货厂别 | |
| 46 | + */ | |
| 47 | + @TableField(exist = false) | |
| 48 | + private String workshopName; | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 备注 | |
| 52 | + */ | |
| 53 | + private String remarks; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * 要车单 | |
| 57 | + */ | |
| 58 | + @TableField(exist = false) | |
| 59 | + private List<RequestCarTicket> requestCarTicketList; | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 创建人ID | |
| 63 | + */ | |
| 64 | + @TableField(fill = FieldFill.INSERT) | |
| 65 | + private String createById; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 创建人 | |
| 69 | + */ | |
| 70 | + @TableField(fill = FieldFill.INSERT) | |
| 71 | + private String createBy; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 更新人ID | |
| 75 | + */ | |
| 76 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 77 | + private String updateById; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 更新人 | |
| 81 | + */ | |
| 82 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 83 | + private String updateBy; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 创建时间 | |
| 87 | + */ | |
| 88 | + @TableField(fill = FieldFill.INSERT) | |
| 89 | + private LocalDateTime createTime; | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 更新时间 | |
| 93 | + */ | |
| 94 | + @TableField(fill = FieldFill.INSERT_UPDATE) | |
| 95 | + private LocalDateTime updateTime; | |
| 96 | + | |
| 97 | +} | ... | ... |
| ... | ... | @@ -1223,6 +1223,9 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM |
| 1223 | 1223 | |
| 1224 | 1224 | Map<String, List<String>> userIdMap = sysUserDeptService.mapAllUserByUserId(userIdList, true); |
| 1225 | 1225 | List<String> userIds = userIdMap.get(currentUserId); |
| 1226 | + if (CollectionUtils.isEmpty(userIds)) { | |
| 1227 | + return new ArrayList<>(); | |
| 1228 | + } | |
| 1226 | 1229 | |
| 1227 | 1230 | return sysUserService.listByUserId(userIds); |
| 1228 | 1231 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/car/CarRequestPlanServiceImpl.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.impl.shipments.car; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 5 | +import com.github.pagehelper.PageInfo; | |
| 6 | +import com.lframework.starter.common.utils.CollectionUtil; | |
| 7 | +import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | |
| 8 | +import com.lframework.starter.web.core.utils.PageResultUtil; | |
| 9 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 10 | +import com.lframework.starter.web.core.utils.OpLogUtil; | |
| 11 | +import com.lframework.starter.common.utils.StringUtil; | |
| 12 | +import com.lframework.starter.common.exceptions.impl.DefaultClientException; | |
| 13 | +import java.io.Serializable; | |
| 14 | +import com.lframework.starter.web.core.utils.IdUtil; | |
| 15 | +import com.lframework.starter.common.utils.ObjectUtil; | |
| 16 | +import com.lframework.starter.web.core.annotations.oplog.OpLog; | |
| 17 | +import com.lframework.starter.web.core.utils.PageHelperUtil; | |
| 18 | +import com.lframework.starter.common.utils.Assert; | |
| 19 | +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | |
| 20 | +import com.lframework.xingyun.sc.entity.CarRequestPlan; | |
| 21 | +import com.lframework.xingyun.sc.mappers.CarRequestPlanMapper; | |
| 22 | +import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; | |
| 23 | +import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo; | |
| 24 | +import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; | |
| 25 | +import com.lframework.xingyun.sc.vo.shipments.car.UpdateCarRequestPlanVo; | |
| 26 | +import org.springframework.transaction.annotation.Transactional; | |
| 27 | +import org.springframework.stereotype.Service; | |
| 28 | + | |
| 29 | +import java.text.SimpleDateFormat; | |
| 30 | +import java.time.LocalDate; | |
| 31 | +import java.util.Date; | |
| 32 | +import java.util.List; | |
| 33 | + | |
| 34 | +@Service | |
| 35 | +public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanMapper, CarRequestPlan> implements CarRequestPlanService { | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public PageResult<CarRequestPlan> query(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo) { | |
| 39 | + | |
| 40 | + Assert.greaterThanZero(pageIndex); | |
| 41 | + Assert.greaterThanZero(pageSize); | |
| 42 | + | |
| 43 | + PageHelperUtil.startPage(pageIndex, pageSize); | |
| 44 | + List<CarRequestPlan> datas = this.query(vo); | |
| 45 | + | |
| 46 | + return PageResultUtil.convert(new PageInfo<>(datas)); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public List<CarRequestPlan> query(QueryCarRequestPlanVo vo) { | |
| 51 | + | |
| 52 | + return getBaseMapper().query(vo); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Override | |
| 56 | + public CarRequestPlan findById(String id) { | |
| 57 | + | |
| 58 | + return getBaseMapper().findById(id); | |
| 59 | + } | |
| 60 | + | |
| 61 | + @OpLog(type = OtherOpLogType.class, name = "新增要车计划,ID:{}", params = {"#id"}) | |
| 62 | + @Transactional(rollbackFor = Exception.class) | |
| 63 | + @Override | |
| 64 | + public String create(CreateCarRequestPlanVo vo) { | |
| 65 | + //新增要车计划时先判断当前日期+装货厂别是否已经存在要车计划,不再存在再新增 | |
| 66 | + QueryCarRequestPlanVo vo1 = new QueryCarRequestPlanVo(); | |
| 67 | + vo1.setWorkshopId(vo.getWorkshopId()); | |
| 68 | + LocalDate date = vo.getRequestCarData(); | |
| 69 | + if (date != null) { | |
| 70 | + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | |
| 71 | + String dateString = formatter.format(date); | |
| 72 | + vo1.setRequestCarDataStart(dateString); | |
| 73 | + vo1.setRequestCarDataEnd(dateString); | |
| 74 | + } | |
| 75 | + List<CarRequestPlan> carRequestPlanList = this.query(vo1); | |
| 76 | + if (CollectionUtil.isNotEmpty(carRequestPlanList)) { | |
| 77 | + CarRequestPlan carRequestPlan = carRequestPlanList.get(0); | |
| 78 | + return carRequestPlan.getId(); | |
| 79 | + } | |
| 80 | + | |
| 81 | + CarRequestPlan data = new CarRequestPlan(); | |
| 82 | + data.setId(IdUtil.getId()); | |
| 83 | + if (vo.getRequestCarData() != null) { | |
| 84 | + data.setRequestCarData(vo.getRequestCarData()); | |
| 85 | + } | |
| 86 | + if (!StringUtil.isBlank(vo.getWorkshopId())) { | |
| 87 | + data.setWorkshopId(vo.getWorkshopId()); | |
| 88 | + } | |
| 89 | + if (!StringUtil.isBlank(vo.getRemarks())) { | |
| 90 | + data.setRemarks(vo.getRemarks()); | |
| 91 | + } | |
| 92 | + | |
| 93 | + getBaseMapper().insert(data); | |
| 94 | + | |
| 95 | + OpLogUtil.setVariable("id", data.getId()); | |
| 96 | + OpLogUtil.setExtra(vo); | |
| 97 | + | |
| 98 | + return data.getId(); | |
| 99 | + } | |
| 100 | + | |
| 101 | + @OpLog(type = OtherOpLogType.class, name = "修改要车计划,ID:{}", params = {"#id"}) | |
| 102 | + @Transactional(rollbackFor = Exception.class) | |
| 103 | + @Override | |
| 104 | + public void update(UpdateCarRequestPlanVo vo) { | |
| 105 | + | |
| 106 | + CarRequestPlan data = getBaseMapper().selectById(vo.getId()); | |
| 107 | + if (ObjectUtil.isNull(data)) { | |
| 108 | + throw new DefaultClientException("要车计划不存在!"); | |
| 109 | + } | |
| 110 | + | |
| 111 | + LambdaUpdateWrapper<CarRequestPlan> updateWrapper = Wrappers.lambdaUpdate(CarRequestPlan.class) | |
| 112 | + .set(CarRequestPlan::getRequestCarData, vo.getRequestCarData() == null ? null : vo.getRequestCarData()) | |
| 113 | + .set(CarRequestPlan::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId()) | |
| 114 | + .set(CarRequestPlan::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks()) | |
| 115 | + .eq(CarRequestPlan::getId, vo.getId()); | |
| 116 | + | |
| 117 | + getBaseMapper().update(updateWrapper); | |
| 118 | + | |
| 119 | + OpLogUtil.setVariable("id", data.getId()); | |
| 120 | + OpLogUtil.setExtra(vo); | |
| 121 | + } | |
| 122 | + | |
| 123 | + @OpLog(type = OtherOpLogType.class, name = "删除要车计划,ID:{}", params = {"#id"}) | |
| 124 | + @Transactional(rollbackFor = Exception.class) | |
| 125 | + @Override | |
| 126 | + public void deleteById(String id) { | |
| 127 | + | |
| 128 | + getBaseMapper().deleteById(id); | |
| 129 | + } | |
| 130 | + | |
| 131 | + @Override | |
| 132 | + public void cleanCacheByKey(Serializable key) { | |
| 133 | + | |
| 134 | + } | |
| 135 | +} | ... | ... |
| ... | ... | @@ -86,6 +86,14 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq |
| 86 | 86 | @Override |
| 87 | 87 | public String create(CreateDraftRequestCarTicketVo vo) { |
| 88 | 88 | |
| 89 | + //草稿要车单一个订货单只生成一次 | |
| 90 | + QueryDraftRequestCarTicketVo vo1 = new QueryDraftRequestCarTicketVo(); | |
| 91 | + vo1.setPurchaseOrderId(vo.getPurchaseOrderId()); | |
| 92 | + List<DraftRequestCarTicket> query = query(vo1); | |
| 93 | + if (CollectionUtils.isNotEmpty(query)) { | |
| 94 | + return query.get(0).getId(); | |
| 95 | + } | |
| 96 | + | |
| 89 | 97 | DraftRequestCarTicket data = new DraftRequestCarTicket(); |
| 90 | 98 | data.setId(IdUtil.getId()); |
| 91 | 99 | if (!StringUtil.isBlank(vo.getPurchaseOrderId())) { | ... | ... |
| ... | ... | @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 5 | import com.github.pagehelper.PageInfo; |
| 6 | 6 | import com.lframework.starter.bpm.service.FlowInstanceWrapperService; |
| 7 | -import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 8 | 7 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 9 | 8 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 10 | 9 | import com.lframework.starter.web.core.components.resp.PageResult; |
| ... | ... | @@ -71,6 +70,9 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 71 | 70 | if (!StringUtil.isBlank(vo.getDraftId())) { |
| 72 | 71 | data.setDraftId(vo.getDraftId()); |
| 73 | 72 | } |
| 73 | + if (!StringUtil.isBlank(vo.getPlanId())) { | |
| 74 | + data.setPlanId(vo.getPlanId()); | |
| 75 | + } | |
| 74 | 76 | if (!StringUtil.isBlank(vo.getPurchaseOrderId())) { |
| 75 | 77 | data.setPurchaseOrderId(vo.getPurchaseOrderId()); |
| 76 | 78 | } |
| ... | ... | @@ -152,6 +154,7 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 152 | 154 | |
| 153 | 155 | LambdaUpdateWrapper<RequestCarTicket> updateWrapper = Wrappers.lambdaUpdate(RequestCarTicket.class) |
| 154 | 156 | .set(RequestCarTicket::getDraftId, StringUtil.isBlank(vo.getDraftId()) ? null : vo.getDraftId()) |
| 157 | + .set(RequestCarTicket::getPlanId, StringUtil.isBlank(vo.getPlanId()) ? null : vo.getPlanId()) | |
| 155 | 158 | .set(RequestCarTicket::getPurchaseOrderId, StringUtil.isBlank(vo.getPurchaseOrderId()) ? null : vo.getPurchaseOrderId()) |
| 156 | 159 | .set(RequestCarTicket::getRequestCarData, vo.getRequestCarData() == null ? null : vo.getRequestCarData()) |
| 157 | 160 | .set(RequestCarTicket::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId()) | ... | ... |
| 1 | +package com.lframework.xingyun.sc.mappers; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.mapper.BaseMapper; | |
| 4 | +import com.lframework.xingyun.sc.entity.CarRequestPlan; | |
| 5 | +import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | + | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 要车计划表 Mapper 接口 | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + */ | |
| 16 | +public interface CarRequestPlanMapper extends BaseMapper<CarRequestPlan> { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 查询列表 | |
| 20 | + * @param vo | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + List<CarRequestPlan> query(@Param("vo") QueryCarRequestPlanVo vo); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 查询 | |
| 27 | + * | |
| 28 | + * @param id 主键 | |
| 29 | + * @return CarRequestPlan | |
| 30 | + */ | |
| 31 | + CarRequestPlan findById(@Param("id") String id); | |
| 32 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/shipments/car/CarRequestPlanService.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.service.shipments.car; | |
| 2 | + | |
| 3 | +import com.lframework.starter.web.core.service.BaseMpService; | |
| 4 | +import com.lframework.starter.web.core.components.resp.PageResult; | |
| 5 | +import com.lframework.xingyun.sc.entity.CarRequestPlan; | |
| 6 | +import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo; | |
| 7 | +import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; | |
| 8 | +import com.lframework.xingyun.sc.vo.shipments.car.UpdateCarRequestPlanVo; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 要车计划表 Service | |
| 13 | + */ | |
| 14 | +public interface CarRequestPlanService extends BaseMpService<CarRequestPlan> { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 查询列表 | |
| 18 | + * @return | |
| 19 | + */ | |
| 20 | + PageResult<CarRequestPlan> query(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询列表 | |
| 24 | + * @param vo | |
| 25 | + * @return | |
| 26 | + */ | |
| 27 | + List<CarRequestPlan> query(QueryCarRequestPlanVo vo); | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 根据ID查询 | |
| 31 | + * @param id | |
| 32 | + * @return | |
| 33 | + */ | |
| 34 | + CarRequestPlan findById(String id); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 创建 | |
| 38 | + * @param vo | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + String create(CreateCarRequestPlanVo vo); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 修改 | |
| 45 | + * @param vo | |
| 46 | + */ | |
| 47 | + void update(UpdateCarRequestPlanVo vo); | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 根据ID删除 | |
| 51 | + * @param id | |
| 52 | + * @return | |
| 53 | + */ | |
| 54 | + void deleteById(String id); | |
| 55 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/car/CreateCarRequestPlanVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.vo.shipments.car; | |
| 2 | + | |
| 3 | +import java.time.LocalDate; | |
| 4 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 7 | +import org.hibernate.validator.constraints.Length; | |
| 8 | +import java.io.Serializable; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +@Data | |
| 12 | +public class CreateCarRequestPlanVo implements BaseVo, Serializable { | |
| 13 | + | |
| 14 | + private static final long serialVersionUID = 1L; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 要车日期 | |
| 18 | + */ | |
| 19 | + @ApiModelProperty("要车日期") | |
| 20 | + @TypeMismatch(message = "要车日期格式有误!") | |
| 21 | + private LocalDate requestCarData; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 装货厂别 | |
| 25 | + */ | |
| 26 | + @ApiModelProperty("装货厂别") | |
| 27 | + @Length(message = "装货厂别最多允许32个字符!") | |
| 28 | + private String workshopId; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 备注 | |
| 32 | + */ | |
| 33 | + @ApiModelProperty("备注") | |
| 34 | + @Length(message = "备注最多允许500个字符!") | |
| 35 | + private String remarks; | |
| 36 | + | |
| 37 | +} | ... | ... |
| ... | ... | @@ -22,6 +22,12 @@ public class CreateRequestCarTicketVo implements BaseVo, Serializable { |
| 22 | 22 | private String draftId; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | + * 要车计划ID | |
| 26 | + */ | |
| 27 | + @ApiModelProperty("要车计划ID") | |
| 28 | + private String planId; | |
| 29 | + | |
| 30 | + /** | |
| 25 | 31 | * 订货单ID |
| 26 | 32 | */ |
| 27 | 33 | @ApiModelProperty("订货单ID") | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/car/QueryCarRequestPlanVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.vo.shipments.car; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import com.lframework.starter.web.core.vo.PageVo; | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | +import java.io.Serializable; | |
| 10 | + | |
| 11 | +@Data | |
| 12 | +public class QueryCarRequestPlanVo extends PageVo implements BaseVo, Serializable { | |
| 13 | + | |
| 14 | + private static final long serialVersionUID = 1L; | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 要车日期开始 | |
| 18 | + */ | |
| 19 | + @ApiModelProperty("要车日期开始") | |
| 20 | + private String requestCarDataStart; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 要车日期结束 | |
| 24 | + */ | |
| 25 | + @ApiModelProperty("要车日期结束") | |
| 26 | + private String requestCarDataEnd; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 装货厂别 | |
| 30 | + */ | |
| 31 | + @ApiModelProperty("装货厂别") | |
| 32 | + private String workshopId; | |
| 33 | + | |
| 34 | + | |
| 35 | +} | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/car/UpdateCarRequestPlanVo.java
0 → 100644
| 1 | +package com.lframework.xingyun.sc.vo.shipments.car; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import javax.validation.constraints.NotBlank; | |
| 5 | +import java.time.LocalDate; | |
| 6 | +import com.lframework.starter.web.core.vo.BaseVo; | |
| 7 | +import com.lframework.starter.web.core.components.validation.TypeMismatch; | |
| 8 | +import io.swagger.annotations.ApiModelProperty; | |
| 9 | +import org.hibernate.validator.constraints.Length; | |
| 10 | +import java.io.Serializable; | |
| 11 | + | |
| 12 | +@Data | |
| 13 | +public class UpdateCarRequestPlanVo implements BaseVo, Serializable { | |
| 14 | + | |
| 15 | + private static final long serialVersionUID = 1L; | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * ID | |
| 19 | + */ | |
| 20 | + @ApiModelProperty(value = "ID", required = true) | |
| 21 | + @NotBlank(message = "id不能为空!") | |
| 22 | + private String id; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 要车日期 | |
| 26 | + */ | |
| 27 | + @ApiModelProperty("要车日期") | |
| 28 | + @TypeMismatch(message = "要车日期格式有误!") | |
| 29 | + private LocalDate requestCarData; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 装货厂别 | |
| 33 | + */ | |
| 34 | + @ApiModelProperty("装货厂别") | |
| 35 | + @Length(message = "装货厂别最多允许32个字符!") | |
| 36 | + private String workshopId; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 备注 | |
| 40 | + */ | |
| 41 | + @ApiModelProperty("备注") | |
| 42 | + @Length(message = "备注最多允许500个字符!") | |
| 43 | + private String remarks; | |
| 44 | + | |
| 45 | +} | ... | ... |
| ... | ... | @@ -24,6 +24,12 @@ public class UpdateRequestCarTicketVo implements BaseVo, Serializable { |
| 24 | 24 | private String id; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | + * 要车计划ID | |
| 28 | + */ | |
| 29 | + @ApiModelProperty("要车计划ID") | |
| 30 | + private String planId; | |
| 31 | + | |
| 32 | + /** | |
| 27 | 33 | * 草稿要车单ID |
| 28 | 34 | */ |
| 29 | 35 | @ApiModelProperty("草稿要车单ID") | ... | ... |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.lframework.xingyun.sc.mappers.CarRequestPlanMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="CarRequestPlan" type="com.lframework.xingyun.sc.entity.CarRequestPlan"> | |
| 6 | + <id column="id" property="id"/> | |
| 7 | + <result column="request_car_data" property="requestCarData"/> | |
| 8 | + <result column="workshop_id" property="workshopId"/> | |
| 9 | + <result column="workshop_name" property="workshopName"/> | |
| 10 | + <result column="remarks" property="remarks"/> | |
| 11 | + <result column="create_by_id" property="createById"/> | |
| 12 | + <result column="create_by" property="createBy"/> | |
| 13 | + <result column="update_by_id" property="updateById"/> | |
| 14 | + <result column="update_by" property="updateBy"/> | |
| 15 | + <result column="create_time" property="createTime"/> | |
| 16 | + <result column="update_time" property="updateTime"/> | |
| 17 | + </resultMap> | |
| 18 | + | |
| 19 | + <sql id="CarRequestPlan_sql"> | |
| 20 | + SELECT | |
| 21 | + tb.id, | |
| 22 | + tb.request_car_data, | |
| 23 | + tb.workshop_id, | |
| 24 | + ws.name AS workshop_name, | |
| 25 | + tb.remarks, | |
| 26 | + tb.create_by_id, | |
| 27 | + tb.create_by, | |
| 28 | + tb.update_by_id, | |
| 29 | + tb.update_by, | |
| 30 | + tb.create_time, | |
| 31 | + tb.update_time | |
| 32 | + FROM car_request_plan AS tb | |
| 33 | + left join base_data_workshop as ws on ws.id = tb.workshop_id | |
| 34 | + </sql> | |
| 35 | + | |
| 36 | + <select id="query" resultMap="CarRequestPlan"> | |
| 37 | + <include refid="CarRequestPlan_sql"/> | |
| 38 | + <where> | |
| 39 | + <if test="vo.requestCarDataStart != null"> | |
| 40 | + AND tb.request_car_data >= #{vo.requestCarDataStart} | |
| 41 | + </if> | |
| 42 | + <if test="vo.requestCarDataEnd != null"> | |
| 43 | + <![CDATA[ | |
| 44 | + AND tb.request_car_data <= #{vo.requestCarDataEnd} | |
| 45 | + ]]> | |
| 46 | + </if> | |
| 47 | + <if test="vo.workshopId != null and vo.workshopId != ''"> | |
| 48 | + AND tb.workshop_id = #{vo.workshopId} | |
| 49 | + </if> | |
| 50 | + </where> | |
| 51 | + ORDER BY tb.request_car_data DESC | |
| 52 | + </select> | |
| 53 | + | |
| 54 | + <select id="findById" resultType="com.lframework.xingyun.sc.entity.CarRequestPlan"> | |
| 55 | + <include refid="CarRequestPlan_sql"/> | |
| 56 | + <where> | |
| 57 | + <if test="id != null and id != ''"> | |
| 58 | + AND tb.id = #{id} | |
| 59 | + </if> | |
| 60 | + </where> | |
| 61 | + </select> | |
| 62 | +</mapper> | ... | ... |
| ... | ... | @@ -103,6 +103,9 @@ |
| 103 | 103 | <if test="vo.status != null and vo.status != ''"> |
| 104 | 104 | AND tb.status = #{vo.status} |
| 105 | 105 | </if> |
| 106 | + <if test="vo.purchaseOrderId != null and vo.purchaseOrderId != ''"> | |
| 107 | + AND tb.purchase_order_id = #{vo.purchaseOrderId} | |
| 108 | + </if> | |
| 106 | 109 | </where> |
| 107 | 110 | ORDER BY tb.update_time DESC |
| 108 | 111 | </select> | ... | ... |
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | <resultMap id="RequestCarTicket" type="com.lframework.xingyun.sc.entity.RequestCarTicket"> |
| 6 | 6 | <id column="id" property="id"/> |
| 7 | 7 | <result column="draft_id" property="draftId"/> |
| 8 | + <result column="plan_id" property="planId"/> | |
| 8 | 9 | <result column="purchase_order_id" property="purchaseOrderId"/> |
| 9 | 10 | <result column="request_car_data" property="requestCarData"/> |
| 10 | 11 | <result column="dept_id" property="deptId"/> |
| ... | ... | @@ -41,6 +42,7 @@ |
| 41 | 42 | SELECT |
| 42 | 43 | tb.id, |
| 43 | 44 | tb.draft_id, |
| 45 | + tb.plan_id, | |
| 44 | 46 | tb.purchase_order_id, |
| 45 | 47 | tb.request_car_data, |
| 46 | 48 | tb.dept_id, |
| ... | ... | @@ -105,6 +107,9 @@ |
| 105 | 107 | <if test="vo.status != null and vo.status != ''"> |
| 106 | 108 | AND tb.status = #{vo.status} |
| 107 | 109 | </if> |
| 110 | + <if test="vo.planId != null and vo.planId != ''"> | |
| 111 | + AND tb.plan_id = #{planId} | |
| 112 | + </if> | |
| 108 | 113 | </where> |
| 109 | 114 | ORDER BY tb.update_time DESC |
| 110 | 115 | </select> | ... | ... |