Showing
8 changed files
with
144 additions
and
9 deletions
| ... | ... | @@ -1235,6 +1235,8 @@ alter table tbl_purchase_order_line add column contract_distributor_line_id varc |
| 1235 | 1235 | |
| 1236 | 1236 | CREATE TABLE `product_sample_confirmation_slip` ( |
| 1237 | 1237 | `id` varchar(32) NOT NULL COMMENT 'ID', |
| 1238 | + `order_id` varchar(32) DEFAULT NULL COMMENT '订货单ID', | |
| 1239 | + `region` varchar(32) DEFAULT NULL COMMENT '区域', | |
| 1238 | 1240 | `ordering_unit` varchar(32) DEFAULT NULL COMMENT '订货单位ID', |
| 1239 | 1241 | `sample_type` varchar(50) DEFAULT NULL COMMENT '试样种类', |
| 1240 | 1242 | `customer_type` varchar(50) DEFAULT NULL comment '客户类型', | ... | ... |
| ... | ... | @@ -3,17 +3,25 @@ package com.lframework.xingyun.sc.bo.sample.confirm; |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | 4 | import java.math.BigDecimal; |
| 5 | 5 | import com.lframework.starter.common.constants.StringPool; |
| 6 | +import com.lframework.starter.common.utils.StringUtil; | |
| 6 | 7 | import com.lframework.starter.web.core.bo.BaseBo; |
| 7 | 8 | import java.time.LocalDateTime; |
| 8 | 9 | import java.util.List; |
| 10 | +import java.util.stream.Collectors; | |
| 9 | 11 | |
| 12 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 10 | 13 | import com.lframework.starter.web.core.utils.ApplicationUtil; |
| 11 | 14 | import com.lframework.starter.web.inner.entity.SysDataDicItem; |
| 15 | +import com.lframework.starter.web.inner.entity.SysUserDept; | |
| 12 | 16 | import com.lframework.starter.web.inner.service.system.SysDataDicItemService; |
| 17 | +import com.lframework.starter.web.inner.service.system.SysUserDeptService; | |
| 13 | 18 | import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; |
| 19 | +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo; | |
| 20 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | |
| 14 | 21 | import io.swagger.annotations.ApiModelProperty; |
| 15 | 22 | |
| 16 | 23 | import lombok.Data; |
| 24 | +import org.apache.commons.collections.CollectionUtils; | |
| 17 | 25 | |
| 18 | 26 | /** |
| 19 | 27 | * <p> |
| ... | ... | @@ -142,7 +150,13 @@ public class GetProductSampleConfirmationSlipBo extends BaseBo<ProductSampleConf |
| 142 | 150 | * 是否展示编辑按钮 |
| 143 | 151 | */ |
| 144 | 152 | @ApiModelProperty("是否展示编辑按钮") |
| 145 | - private String showAudit; | |
| 153 | + private boolean showAudit; | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * 是否展示审核按钮 | |
| 157 | + */ | |
| 158 | + @ApiModelProperty("是否展示审核按钮") | |
| 159 | + private boolean showExamine; | |
| 146 | 160 | |
| 147 | 161 | /** |
| 148 | 162 | * 产品试样确认单详情 |
| ... | ... | @@ -419,5 +433,18 @@ public class GetProductSampleConfirmationSlipBo extends BaseBo<ProductSampleConf |
| 419 | 433 | this.sampleTypeName = dataDicItem == null ? "" : dataDicItem.getName(); |
| 420 | 434 | SysDataDicItem dataDicItem1 = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", dto.getCustomerType()); |
| 421 | 435 | this.customerTypeName = dataDicItem1 == null ? "" : dataDicItem1.getName(); |
| 436 | + //判断是否可编辑 | |
| 437 | + //区域 | |
| 438 | + String region = dto.getRegion(); | |
| 439 | + this.showAudit = false; | |
| 440 | + if (StringUtil.isNotEmpty(region)) { | |
| 441 | + SysUserDeptService sysUserDeptService = ApplicationUtil.getBean(SysUserDeptService.class); | |
| 442 | + List<SysUserDept> byDeptId = sysUserDeptService.getByDeptId(region); | |
| 443 | + if (CollectionUtils.isNotEmpty(byDeptId)) { | |
| 444 | + List<String> userIds = byDeptId.stream().map(SysUserDept::getUserId).collect(Collectors.toList()); | |
| 445 | + String userId = SecurityUtil.getCurrentUser().getId(); | |
| 446 | + this.showAudit = (userIds.contains(userId)); | |
| 447 | + } | |
| 448 | + } | |
| 422 | 449 | } |
| 423 | 450 | } | ... | ... |
| ... | ... | @@ -3,15 +3,25 @@ package com.lframework.xingyun.sc.bo.sample.confirm; |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | 4 | import java.math.BigDecimal; |
| 5 | 5 | import com.lframework.starter.common.constants.StringPool; |
| 6 | +import com.lframework.starter.common.utils.StringUtil; | |
| 6 | 7 | import com.lframework.starter.web.core.bo.BaseBo; |
| 7 | 8 | import java.time.LocalDateTime; |
| 9 | +import java.util.List; | |
| 10 | +import java.util.stream.Collectors; | |
| 11 | + | |
| 12 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 8 | 13 | import com.lframework.starter.web.core.utils.ApplicationUtil; |
| 9 | 14 | import com.lframework.starter.web.inner.entity.SysDataDicItem; |
| 15 | +import com.lframework.starter.web.inner.entity.SysUserDept; | |
| 10 | 16 | import com.lframework.starter.web.inner.service.system.SysDataDicItemService; |
| 17 | +import com.lframework.starter.web.inner.service.system.SysUserDeptService; | |
| 11 | 18 | import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; |
| 19 | +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo; | |
| 20 | +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | |
| 12 | 21 | import io.swagger.annotations.ApiModelProperty; |
| 13 | 22 | |
| 14 | 23 | import lombok.Data; |
| 24 | +import org.apache.commons.collections.CollectionUtils; | |
| 15 | 25 | |
| 16 | 26 | /** |
| 17 | 27 | * <p> |
| ... | ... | @@ -142,7 +152,13 @@ public class QueryProductSampleConfirmationSlipBo extends BaseBo<ProductSampleCo |
| 142 | 152 | * 是否展示编辑按钮 |
| 143 | 153 | */ |
| 144 | 154 | @ApiModelProperty("是否展示编辑按钮") |
| 145 | - private String showAudit; | |
| 155 | + private boolean showAudit; | |
| 156 | + | |
| 157 | + /** | |
| 158 | + * 是否展示审核按钮 | |
| 159 | + */ | |
| 160 | + @ApiModelProperty("是否展示审核按钮") | |
| 161 | + private boolean showExamine; | |
| 146 | 162 | |
| 147 | 163 | /** |
| 148 | 164 | * 创建人ID |
| ... | ... | @@ -203,5 +219,17 @@ public class QueryProductSampleConfirmationSlipBo extends BaseBo<ProductSampleCo |
| 203 | 219 | this.sampleTypeName = dataDicItem == null ? "" : dataDicItem.getName(); |
| 204 | 220 | SysDataDicItem dataDicItem1 = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", dto.getCustomerType()); |
| 205 | 221 | this.customerTypeName = dataDicItem1 == null ? "" : dataDicItem1.getName(); |
| 222 | + //判断是否可编辑 | |
| 223 | + String region = dto.getRegion(); | |
| 224 | + this.showAudit = false; | |
| 225 | + if (StringUtil.isNotEmpty(region)) { | |
| 226 | + SysUserDeptService sysUserDeptService = ApplicationUtil.getBean(SysUserDeptService.class); | |
| 227 | + List<SysUserDept> byDeptId = sysUserDeptService.getByDeptId(region); | |
| 228 | + if (CollectionUtils.isNotEmpty(byDeptId)) { | |
| 229 | + List<String> userIds = byDeptId.stream().map(SysUserDept::getUserId).collect(Collectors.toList()); | |
| 230 | + String userId = SecurityUtil.getCurrentUser().getId(); | |
| 231 | + this.showAudit = (userIds.contains(userId)); | |
| 232 | + } | |
| 233 | + } | |
| 206 | 234 | } |
| 207 | 235 | } | ... | ... |
| 1 | 1 | package com.lframework.xingyun.sc.controller.sample; |
| 2 | 2 | |
| 3 | +import com.lframework.starter.bpm.dto.FlowTaskDto; | |
| 4 | +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | |
| 5 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | |
| 3 | 6 | import com.lframework.starter.web.core.annotations.security.HasPermission; |
| 7 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 4 | 8 | import com.lframework.starter.web.core.controller.DefaultBaseController; |
| 5 | 9 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 6 | 10 | import com.lframework.starter.web.core.components.resp.PageResult; |
| 7 | 11 | import com.lframework.starter.web.core.components.resp.InvokeResult; |
| 8 | - | |
| 9 | 12 | import javax.annotation.Resource; |
| 10 | 13 | import javax.validation.constraints.NotBlank; |
| 11 | 14 | import com.lframework.xingyun.sc.bo.sample.confirm.GetProductSampleConfirmationSlipBo; |
| ... | ... | @@ -25,8 +28,8 @@ import com.lframework.starter.common.exceptions.impl.DefaultClientException; |
| 25 | 28 | import io.swagger.annotations.ApiOperation; |
| 26 | 29 | import com.lframework.starter.common.utils.CollectionUtil; |
| 27 | 30 | import io.swagger.annotations.Api; |
| 31 | +import org.apache.commons.collections.CollectionUtils; | |
| 28 | 32 | import org.springframework.web.bind.annotation.DeleteMapping; |
| 29 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 30 | 33 | import org.springframework.validation.annotation.Validated; |
| 31 | 34 | import org.springframework.web.bind.annotation.*; |
| 32 | 35 | import javax.validation.Valid; |
| ... | ... | @@ -47,6 +50,8 @@ public class ProductSampleConfirmationSlipController extends DefaultBaseControll |
| 47 | 50 | private ProductSampleConfirmationSlipService productSampleConfirmationSlipService; |
| 48 | 51 | @Resource |
| 49 | 52 | private ProductSampleConfirmationSlipDetailService productSampleConfirmationSlipDetailService; |
| 53 | + @Resource | |
| 54 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | |
| 50 | 55 | |
| 51 | 56 | /** |
| 52 | 57 | * 查询列表 |
| ... | ... | @@ -91,6 +96,14 @@ public class ProductSampleConfirmationSlipController extends DefaultBaseControll |
| 91 | 96 | detailBoList = detailList.stream().map(QueryProductSampleConfirmationSlipDetailBo::new).collect(Collectors.toList()); |
| 92 | 97 | result.setProductSampleConfirmationSlipDetailList(detailBoList); |
| 93 | 98 | } |
| 99 | + // 获取当前人员的待办任务数据 | |
| 100 | + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | |
| 101 | + if (CollectionUtils.isNotEmpty(flowTaskList)) { | |
| 102 | + List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList()); | |
| 103 | + result.setShowExamine(businessIds.contains(result.getId())); | |
| 104 | + } else { | |
| 105 | + result.setShowExamine(false); | |
| 106 | + } | |
| 94 | 107 | |
| 95 | 108 | return InvokeResultBuilder.success(result); |
| 96 | 109 | } | ... | ... |
| ... | ... | @@ -29,6 +29,16 @@ public class ProductSampleConfirmationSlip extends BaseEntity implements BaseDto |
| 29 | 29 | private String id; |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | + * 订货单ID | |
| 33 | + */ | |
| 34 | + private String orderId; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 区域 | |
| 38 | + */ | |
| 39 | + private String region; | |
| 40 | + | |
| 41 | + /** | |
| 32 | 42 | * 订货单位ID |
| 33 | 43 | */ |
| 34 | 44 | private String orderingUnit; |
| ... | ... | @@ -106,6 +116,18 @@ public class ProductSampleConfirmationSlip extends BaseEntity implements BaseDto |
| 106 | 116 | private String status; |
| 107 | 117 | |
| 108 | 118 | /** |
| 119 | + * 是否展示编辑按钮 | |
| 120 | + */ | |
| 121 | + @TableField(exist = false) | |
| 122 | + private boolean showAudit; | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * 是否展示审核按钮 | |
| 126 | + */ | |
| 127 | + @TableField(exist = false) | |
| 128 | + private boolean showExamine; | |
| 129 | + | |
| 130 | + /** | |
| 109 | 131 | * 办事处内勤ID |
| 110 | 132 | */ |
| 111 | 133 | private String officeClerk; | ... | ... |
| ... | ... | @@ -3,6 +3,9 @@ package com.lframework.xingyun.sc.impl.sample; |
| 3 | 3 | 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 | +import com.lframework.starter.bpm.dto.FlowTaskDto; | |
| 7 | +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | |
| 8 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | |
| 6 | 9 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 7 | 10 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 8 | 11 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| ... | ... | @@ -18,6 +21,7 @@ import com.lframework.starter.common.utils.StringUtil; |
| 18 | 21 | import com.lframework.starter.common.utils.ObjectUtil; |
| 19 | 22 | import com.lframework.starter.common.utils.Assert; |
| 20 | 23 | import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; |
| 24 | +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo; | |
| 21 | 25 | import com.lframework.xingyun.sc.mappers.ProductSampleConfirmationSlipMapper; |
| 22 | 26 | import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipDetailService; |
| 23 | 27 | import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService; |
| ... | ... | @@ -27,11 +31,14 @@ import org.springframework.transaction.annotation.Transactional; |
| 27 | 31 | import org.springframework.stereotype.Service; |
| 28 | 32 | import javax.annotation.Resource; |
| 29 | 33 | import java.util.List; |
| 34 | +import java.util.stream.Collectors; | |
| 30 | 35 | |
| 31 | 36 | @Service |
| 32 | 37 | public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl<ProductSampleConfirmationSlipMapper, ProductSampleConfirmationSlip> implements ProductSampleConfirmationSlipService { |
| 33 | 38 | @Resource |
| 34 | 39 | private ProductSampleConfirmationSlipDetailService productSampleConfirmationSlipDetailService; |
| 40 | + @Resource | |
| 41 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | |
| 35 | 42 | |
| 36 | 43 | @Override |
| 37 | 44 | public PageResult<ProductSampleConfirmationSlip> query(Integer pageIndex, Integer pageSize, QueryProductSampleConfirmationSlipVo vo) { |
| ... | ... | @@ -42,6 +49,22 @@ public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl< |
| 42 | 49 | PageHelperUtil.startPage(pageIndex, pageSize); |
| 43 | 50 | List<ProductSampleConfirmationSlip> datas = this.query(vo); |
| 44 | 51 | |
| 52 | + if (CollectionUtils.isNotEmpty(datas)) { | |
| 53 | + // 获取当前人员的待办任务数据 | |
| 54 | + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | |
| 55 | + if (CollectionUtils.isEmpty(flowTaskList)) { | |
| 56 | + return PageResultUtil.convert(new PageInfo<>(datas)); | |
| 57 | + } | |
| 58 | + List<String> ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList()); | |
| 59 | + for (ProductSampleConfirmationSlip sampleConfirmationSlip : datas) { | |
| 60 | + if (ids.contains(sampleConfirmationSlip.getId())) { | |
| 61 | + sampleConfirmationSlip.setShowExamine(true); | |
| 62 | + } else { | |
| 63 | + sampleConfirmationSlip.setShowExamine(false); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + } | |
| 67 | + | |
| 45 | 68 | return PageResultUtil.convert(new PageInfo<>(datas)); |
| 46 | 69 | } |
| 47 | 70 | |
| ... | ... | @@ -64,6 +87,10 @@ public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl< |
| 64 | 87 | |
| 65 | 88 | ProductSampleConfirmationSlip data = new ProductSampleConfirmationSlip(); |
| 66 | 89 | data.setId(IdUtil.getId()); |
| 90 | + data.setOrderId(vo.getOrderId()); | |
| 91 | + if (!StringUtil.isBlank(vo.getRegion())) { | |
| 92 | + data.setRegion(vo.getRegion()); | |
| 93 | + } | |
| 67 | 94 | data.setOrderingUnit(vo.getOrderingUnit()); |
| 68 | 95 | if (!StringUtil.isBlank(vo.getWorkshopId())) { |
| 69 | 96 | data.setWorkshopId(vo.getWorkshopId()); |
| ... | ... | @@ -112,7 +139,7 @@ public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl< |
| 112 | 139 | .set(ProductSampleConfirmationSlip::getSampleFrequency, StringUtil.isBlank(vo.getSampleFrequency()) ? null : vo.getSampleFrequency()) |
| 113 | 140 | .set(ProductSampleConfirmationSlip::getEarlyNonconformityDescription, StringUtil.isBlank(vo.getEarlyNonconformityDescription()) ? null : vo.getEarlyNonconformityDescription()) |
| 114 | 141 | .set(ProductSampleConfirmationSlip::getPreparedBy, StringUtil.isBlank(vo.getPreparedBy()) ? null : vo.getPreparedBy()) |
| 115 | - .set(ProductSampleConfirmationSlip::getStatus, StringUtil.isBlank(vo.getStatus()) ? null : vo.getStatus()) | |
| 142 | + .set(ProductSampleConfirmationSlip::getStatus, "AUDIT") | |
| 116 | 143 | .eq(ProductSampleConfirmationSlip::getId, vo.getId()); |
| 117 | 144 | |
| 118 | 145 | getBaseMapper().update(updateWrapper); | ... | ... |
| ... | ... | @@ -3,11 +3,7 @@ package com.lframework.xingyun.sc.vo.sample.confirm; |
| 3 | 3 | import com.lframework.starter.web.core.components.validation.IsNumberPrecision; |
| 4 | 4 | import java.math.BigDecimal; |
| 5 | 5 | import javax.validation.constraints.NotBlank; |
| 6 | -import java.time.LocalDateTime; | |
| 7 | 6 | import com.lframework.starter.web.core.vo.BaseVo; |
| 8 | -import javax.validation.constraints.NotNull; | |
| 9 | - | |
| 10 | -import com.lframework.xingyun.sc.bo.sample.confirm.QueryProductSampleConfirmationSlipDetailBo; | |
| 11 | 7 | import io.swagger.annotations.ApiModelProperty; |
| 12 | 8 | import com.lframework.starter.web.core.components.validation.TypeMismatch; |
| 13 | 9 | import org.hibernate.validator.constraints.Length; |
| ... | ... | @@ -21,6 +17,22 @@ public class CreateProductSampleConfirmationSlipVo implements BaseVo, Serializab |
| 21 | 17 | |
| 22 | 18 | private static final long serialVersionUID = 1L; |
| 23 | 19 | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * 订货单ID | |
| 23 | + */ | |
| 24 | + @ApiModelProperty(value = "订货单ID", required = true) | |
| 25 | + @NotBlank(message = "请输入订货单ID!") | |
| 26 | + @Length(message = "订货单ID最多允许32个字符!") | |
| 27 | + private String orderId; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 区域 | |
| 31 | + */ | |
| 32 | + @ApiModelProperty("区域") | |
| 33 | + @Length(message = "区域最多允许32个字符!") | |
| 34 | + private String region; | |
| 35 | + | |
| 24 | 36 | /** |
| 25 | 37 | * 订货单位ID |
| 26 | 38 | */ | ... | ... |
| ... | ... | @@ -4,6 +4,8 @@ |
| 4 | 4 | |
| 5 | 5 | <resultMap id="ProductSampleConfirmationSlip" type="com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip"> |
| 6 | 6 | <id column="id" property="id"/> |
| 7 | + <result column="order_id" property="orderId"/> | |
| 8 | + <result column="region" property="region"/> | |
| 7 | 9 | <result column="ordering_unit" property="orderingUnit"/> |
| 8 | 10 | <result column="ordering_unit_name" property="orderingUnitName"/> |
| 9 | 11 | <result column="sample_type" property="sampleType"/> |
| ... | ... | @@ -56,6 +58,8 @@ |
| 56 | 58 | <sql id="ProductSampleConfirmationSlip_sql"> |
| 57 | 59 | SELECT |
| 58 | 60 | tb.id, |
| 61 | + tb.order_id, | |
| 62 | + tb.region, | |
| 59 | 63 | tb.ordering_unit, |
| 60 | 64 | cu.name AS ordering_unit_name, |
| 61 | 65 | tb.sample_type, | ... | ... |