Showing
11 changed files
with
196 additions
and
5 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/sample/tracking/GetSampleResultTrackingBo.java
| 1 | package com.lframework.xingyun.sc.bo.sample.tracking; | 1 | package com.lframework.xingyun.sc.bo.sample.tracking; |
| 2 | 2 | ||
| 3 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | 4 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; | 5 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; |
| 5 | import com.lframework.xingyun.sc.entity.SampleResultTracking; | 6 | import com.lframework.xingyun.sc.entity.SampleResultTracking; |
| @@ -160,6 +161,12 @@ public class GetSampleResultTrackingBo extends BaseBo<SampleResultTracking> { | @@ -160,6 +161,12 @@ public class GetSampleResultTrackingBo extends BaseBo<SampleResultTracking> { | ||
| 160 | private String status; | 161 | private String status; |
| 161 | 162 | ||
| 162 | /** | 163 | /** |
| 164 | + * 是否展示审核按钮 | ||
| 165 | + */ | ||
| 166 | + @ApiModelProperty("是否展示审核按钮") | ||
| 167 | + private boolean showExamine; | ||
| 168 | + | ||
| 169 | + /** | ||
| 163 | * 办事处主管审核意见 | 170 | * 办事处主管审核意见 |
| 164 | */ | 171 | */ |
| 165 | @ApiModelProperty("办事处主管审核意见") | 172 | @ApiModelProperty("办事处主管审核意见") |
| 1 | package com.lframework.xingyun.sc.bo.sample.tracking; | 1 | package com.lframework.xingyun.sc.bo.sample.tracking; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonFormat; | 3 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | +import com.lframework.starter.common.utils.StringUtil; | ||
| 5 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 6 | +import com.lframework.starter.web.core.utils.ApplicationUtil; | ||
| 7 | +import com.lframework.starter.web.inner.entity.SysUserDept; | ||
| 8 | +import com.lframework.starter.web.inner.service.system.SysUserDeptService; | ||
| 4 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; | 9 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; |
| 5 | import com.lframework.xingyun.sc.entity.SampleResultTracking; | 10 | import com.lframework.xingyun.sc.entity.SampleResultTracking; |
| 6 | import com.lframework.starter.common.constants.StringPool; | 11 | import com.lframework.starter.common.constants.StringPool; |
| 7 | import com.lframework.starter.web.core.bo.BaseBo; | 12 | import com.lframework.starter.web.core.bo.BaseBo; |
| 8 | import java.time.LocalDateTime; | 13 | import java.time.LocalDateTime; |
| 9 | import java.util.List; | 14 | import java.util.List; |
| 15 | +import java.util.stream.Collectors; | ||
| 10 | 16 | ||
| 11 | import io.swagger.annotations.ApiModelProperty; | 17 | import io.swagger.annotations.ApiModelProperty; |
| 12 | 18 | ||
| 13 | import lombok.Data; | 19 | import lombok.Data; |
| 20 | +import org.apache.commons.collections.CollectionUtils; | ||
| 14 | 21 | ||
| 15 | /** | 22 | /** |
| 16 | * <p> | 23 | * <p> |
| @@ -161,6 +168,18 @@ public class QuerySampleResultTrackingBo extends BaseBo<SampleResultTracking> { | @@ -161,6 +168,18 @@ public class QuerySampleResultTrackingBo extends BaseBo<SampleResultTracking> { | ||
| 161 | private String status; | 168 | private String status; |
| 162 | 169 | ||
| 163 | /** | 170 | /** |
| 171 | + * 是否展示审核按钮 | ||
| 172 | + */ | ||
| 173 | + @ApiModelProperty("是否展示审核按钮") | ||
| 174 | + private boolean showExamine; | ||
| 175 | + | ||
| 176 | + /** | ||
| 177 | + * 是否展示编辑按钮 | ||
| 178 | + */ | ||
| 179 | + @ApiModelProperty("是否展示编辑按钮") | ||
| 180 | + private boolean showAudit; | ||
| 181 | + | ||
| 182 | + /** | ||
| 164 | * 办事处主管审核意见 | 183 | * 办事处主管审核意见 |
| 165 | */ | 184 | */ |
| 166 | @ApiModelProperty("办事处主管审核意见") | 185 | @ApiModelProperty("办事处主管审核意见") |
| @@ -232,6 +251,16 @@ public class QuerySampleResultTrackingBo extends BaseBo<SampleResultTracking> { | @@ -232,6 +251,16 @@ public class QuerySampleResultTrackingBo extends BaseBo<SampleResultTracking> { | ||
| 232 | 251 | ||
| 233 | @Override | 252 | @Override |
| 234 | protected void afterInit(SampleResultTracking dto) { | 253 | protected void afterInit(SampleResultTracking dto) { |
| 235 | - | 254 | + //判断是否可编辑 |
| 255 | + String deptId = dto.getDeptId(); | ||
| 256 | + this.showAudit = false; | ||
| 257 | + if (StringUtil.isNotEmpty(deptId)) { | ||
| 258 | + SysUserDeptService sysUserDeptService = ApplicationUtil.getBean(SysUserDeptService.class); | ||
| 259 | + List<String> userIds = sysUserDeptService.listAllUserByDeptId(deptId, Boolean.TRUE); | ||
| 260 | + if (CollectionUtils.isNotEmpty(userIds)) { | ||
| 261 | + String userId = SecurityUtil.getCurrentUser().getId(); | ||
| 262 | + this.showAudit = (userIds.contains(userId)); | ||
| 263 | + } | ||
| 264 | + } | ||
| 236 | } | 265 | } |
| 237 | } | 266 | } |
| 1 | package com.lframework.xingyun.sc.controller.sample; | 1 | package com.lframework.xingyun.sc.controller.sample; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.resource.ClassPathResource; | 3 | import cn.hutool.core.io.resource.ClassPathResource; |
| 4 | +import com.lframework.starter.bpm.dto.FlowTaskDto; | ||
| 5 | +import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; | ||
| 6 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | ||
| 7 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 4 | import com.lframework.xingyun.sc.bo.sample.tracking.GetSampleResultTrackingBo; | 8 | import com.lframework.xingyun.sc.bo.sample.tracking.GetSampleResultTrackingBo; |
| 5 | import com.lframework.xingyun.sc.bo.sample.tracking.QuerySampleResultTrackingBo; | 9 | import com.lframework.xingyun.sc.bo.sample.tracking.QuerySampleResultTrackingBo; |
| 6 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; | 10 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; |
| @@ -66,6 +70,8 @@ public class SampleResultTrackingController extends DefaultBaseController { | @@ -66,6 +70,8 @@ public class SampleResultTrackingController extends DefaultBaseController { | ||
| 66 | private SampleResultTrackingService sampleResultTrackingService; | 70 | private SampleResultTrackingService sampleResultTrackingService; |
| 67 | @Resource | 71 | @Resource |
| 68 | private SampleFeedbackTrackingDetailService sampleFeedbackTrackingDetailService; | 72 | private SampleFeedbackTrackingDetailService sampleFeedbackTrackingDetailService; |
| 73 | + @Resource | ||
| 74 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | ||
| 69 | 75 | ||
| 70 | 76 | ||
| 71 | /** | 77 | /** |
| @@ -101,6 +107,14 @@ public class SampleResultTrackingController extends DefaultBaseController { | @@ -101,6 +107,14 @@ public class SampleResultTrackingController extends DefaultBaseController { | ||
| 101 | vo.setTrackingId(id); | 107 | vo.setTrackingId(id); |
| 102 | List<SampleFeedbackTrackingDetail> query = sampleFeedbackTrackingDetailService.query(vo); | 108 | List<SampleFeedbackTrackingDetail> query = sampleFeedbackTrackingDetailService.query(vo); |
| 103 | result.setDetailList(query); | 109 | result.setDetailList(query); |
| 110 | + // 获取当前人员的待办任务数据 | ||
| 111 | + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | ||
| 112 | + if (CollectionUtils.isNotEmpty(flowTaskList)) { | ||
| 113 | + List<String> businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList()); | ||
| 114 | + result.setShowExamine(businessIds.contains(result.getId())); | ||
| 115 | + } else { | ||
| 116 | + result.setShowExamine(false); | ||
| 117 | + } | ||
| 104 | 118 | ||
| 105 | return InvokeResultBuilder.success(result); | 119 | return InvokeResultBuilder.success(result); |
| 106 | } | 120 | } |
| @@ -109,7 +123,7 @@ public class SampleResultTrackingController extends DefaultBaseController { | @@ -109,7 +123,7 @@ public class SampleResultTrackingController extends DefaultBaseController { | ||
| 109 | * 新增 | 123 | * 新增 |
| 110 | */ | 124 | */ |
| 111 | @ApiOperation("新增") | 125 | @ApiOperation("新增") |
| 112 | - @HasPermission({"sample:tracking:add"}) | 126 | + @HasPermission({"sample-order:follow-up-form:add"}) |
| 113 | @PostMapping | 127 | @PostMapping |
| 114 | public InvokeResult<Void> create(@Valid @RequestBody CreateSampleResultTrackingVo vo) { | 128 | public InvokeResult<Void> create(@Valid @RequestBody CreateSampleResultTrackingVo vo) { |
| 115 | 129 |
| @@ -33,6 +33,11 @@ public class SampleResultTracking extends BaseEntity implements BaseDto { | @@ -33,6 +33,11 @@ public class SampleResultTracking extends BaseEntity implements BaseDto { | ||
| 33 | private String deptId; | 33 | private String deptId; |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | + * 办事处Code | ||
| 37 | + */ | ||
| 38 | + private String deptCode; | ||
| 39 | + | ||
| 40 | + /** | ||
| 36 | * 客户ID | 41 | * 客户ID |
| 37 | */ | 42 | */ |
| 38 | private String customerId; | 43 | private String customerId; |
| @@ -147,6 +152,12 @@ public class SampleResultTracking extends BaseEntity implements BaseDto { | @@ -147,6 +152,12 @@ public class SampleResultTracking extends BaseEntity implements BaseDto { | ||
| 147 | private String status; | 152 | private String status; |
| 148 | 153 | ||
| 149 | /** | 154 | /** |
| 155 | + * 是否展示审核按钮 | ||
| 156 | + */ | ||
| 157 | + @TableField(exist = false) | ||
| 158 | + private boolean showExamine; | ||
| 159 | + | ||
| 160 | + /** | ||
| 150 | * 办事处主管审核意见 | 161 | * 办事处主管审核意见 |
| 151 | */ | 162 | */ |
| 152 | private String officeSupervisorOpinion; | 163 | private String officeSupervisorOpinion; |
| @@ -31,6 +31,7 @@ import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService; | @@ -31,6 +31,7 @@ import com.lframework.xingyun.sc.service.ledger.ReceiptLedgerInfoService; | ||
| 31 | import com.lframework.xingyun.sc.service.order.*; | 31 | import com.lframework.xingyun.sc.service.order.*; |
| 32 | import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; | 32 | import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; |
| 33 | import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService; | 33 | import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService; |
| 34 | +import com.lframework.xingyun.sc.service.sample.SampleResultTrackingService; | ||
| 34 | import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService; | 35 | import com.lframework.xingyun.sc.service.shipments.ShipmentsOrderInfoService; |
| 35 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; | 36 | import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService; |
| 36 | import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; | 37 | import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; |
| @@ -135,6 +136,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -135,6 +136,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 135 | private SysDataDicItemService sysDataDicItemService; | 136 | private SysDataDicItemService sysDataDicItemService; |
| 136 | @Resource | 137 | @Resource |
| 137 | private ProductSampleConfirmationSlipService productSampleConfirmationSlipService; | 138 | private ProductSampleConfirmationSlipService productSampleConfirmationSlipService; |
| 139 | + @Resource | ||
| 140 | + private SampleResultTrackingService sampleResultTrackingService; | ||
| 138 | 141 | ||
| 139 | 142 | ||
| 140 | 143 | ||
| @@ -207,6 +210,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -207,6 +210,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 207 | case "CONFIRMATION_SLIP": | 210 | case "CONFIRMATION_SLIP": |
| 208 | handleConfirmationSlipData(flowStatus, businessId); | 211 | handleConfirmationSlipData(flowStatus, businessId); |
| 209 | break; | 212 | break; |
| 213 | + case "RESULT_TRACKING": | ||
| 214 | + handleResultTrackingData(flowStatus, businessId); | ||
| 215 | + break; | ||
| 210 | default: | 216 | default: |
| 211 | break; | 217 | break; |
| 212 | } | 218 | } |
| @@ -854,4 +860,16 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -854,4 +860,16 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 854 | productSampleConfirmationSlipService.updateStatus(businessId, "REFUSE"); | 860 | productSampleConfirmationSlipService.updateStatus(businessId, "REFUSE"); |
| 855 | } | 861 | } |
| 856 | } | 862 | } |
| 863 | + | ||
| 864 | + //产品试样跟踪单 | ||
| 865 | + private void handleResultTrackingData(String flowStatus, String businessId) { | ||
| 866 | + if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) | ||
| 867 | + || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { | ||
| 868 | + sampleResultTrackingService.updateStatus(businessId, "PASS"); | ||
| 869 | + } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) | ||
| 870 | + || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) | ||
| 871 | + || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { | ||
| 872 | + sampleResultTrackingService.updateStatus(businessId, "REFUSE"); | ||
| 873 | + } | ||
| 874 | + } | ||
| 857 | } | 875 | } |
| @@ -21,6 +21,7 @@ import com.lframework.xingyun.sc.service.ledger.FundCoordinationService; | @@ -21,6 +21,7 @@ import com.lframework.xingyun.sc.service.ledger.FundCoordinationService; | ||
| 21 | import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; | 21 | import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; |
| 22 | import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; | 22 | import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; |
| 23 | import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService; | 23 | import com.lframework.xingyun.sc.service.sample.ProductSampleConfirmationSlipService; |
| 24 | +import com.lframework.xingyun.sc.service.sample.SampleResultTrackingService; | ||
| 24 | import com.lframework.xingyun.sc.vo.customer.credit.*; | 25 | import com.lframework.xingyun.sc.vo.customer.credit.*; |
| 25 | import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderInfoVo; | 26 | import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderInfoVo; |
| 26 | import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderVo; | 27 | import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderVo; |
| @@ -51,6 +52,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -51,6 +52,8 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 51 | private SysUserRoleService sysUserRoleService; | 52 | private SysUserRoleService sysUserRoleService; |
| 52 | @Resource | 53 | @Resource |
| 53 | private ProductSampleConfirmationSlipService productSampleConfirmationSlipService; | 54 | private ProductSampleConfirmationSlipService productSampleConfirmationSlipService; |
| 55 | + @Resource | ||
| 56 | + private SampleResultTrackingService sampleResultTrackingService; | ||
| 54 | 57 | ||
| 55 | 58 | ||
| 56 | @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) | 59 | @OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"}) |
| @@ -340,4 +343,18 @@ public class FlowTaskServiceImpl implements FlowTaskService { | @@ -340,4 +343,18 @@ public class FlowTaskServiceImpl implements FlowTaskService { | ||
| 340 | } | 343 | } |
| 341 | } | 344 | } |
| 342 | } | 345 | } |
| 346 | + | ||
| 347 | + @Override | ||
| 348 | + public void updateResultTrackingMap(Map<String, Object> map) { | ||
| 349 | + //流程编码 | ||
| 350 | + Object n = map.get("nodeCode"); | ||
| 351 | + String nodeCode = String.valueOf(n); | ||
| 352 | + //审核意见 | ||
| 353 | + Object m = map.get("message"); | ||
| 354 | + String message = String.valueOf(m); | ||
| 355 | + //主键 | ||
| 356 | + Object i = map.get("id"); | ||
| 357 | + String id = String.valueOf(i); | ||
| 358 | + sampleResultTrackingService.updateExamine(id, nodeCode, message); | ||
| 359 | + } | ||
| 343 | } | 360 | } |
| @@ -240,19 +240,19 @@ public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl< | @@ -240,19 +240,19 @@ public class ProductSampleConfirmationSlipServiceImpl extends BaseMpServiceImpl< | ||
| 240 | updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirectorReview, StringUtil.isBlank(review) ? null : review); | 240 | updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirectorReview, StringUtil.isBlank(review) ? null : review); |
| 241 | updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirectorOpinion, StringUtil.isBlank(message) ? null : message); | 241 | updateWrapper.set(ProductSampleConfirmationSlip::getMarketingDeputyDirectorOpinion, StringUtil.isBlank(message) ? null : message); |
| 242 | updateWrapper.eq(ProductSampleConfirmationSlip::getId, id); | 242 | updateWrapper.eq(ProductSampleConfirmationSlip::getId, id); |
| 243 | - } else if (nodeCode.equals("confirmation_slip_4-")) { | 243 | + } else if (nodeCode.startsWith("confirmation_slip_4-")) { |
| 244 | //分厂经营办主管 | 244 | //分厂经营办主管 |
| 245 | updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisor, StringUtil.isBlank(userId) ? null : userId); | 245 | updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisor, StringUtil.isBlank(userId) ? null : userId); |
| 246 | updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisorReview, StringUtil.isBlank(review) ? null : review); | 246 | updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisorReview, StringUtil.isBlank(review) ? null : review); |
| 247 | updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisorOpinion, StringUtil.isBlank(message) ? null : message); | 247 | updateWrapper.set(ProductSampleConfirmationSlip::getOfficeManagementSupervisorOpinion, StringUtil.isBlank(message) ? null : message); |
| 248 | updateWrapper.eq(ProductSampleConfirmationSlip::getId, id); | 248 | updateWrapper.eq(ProductSampleConfirmationSlip::getId, id); |
| 249 | - } else if (nodeCode.equals("confirmation_slip_5-")) { | 249 | + } else if (nodeCode.startsWith("confirmation_slip_5-")) { |
| 250 | //分厂品质经理 | 250 | //分厂品质经理 |
| 251 | updateWrapper.set(ProductSampleConfirmationSlip::getQualityManager, StringUtil.isBlank(userId) ? null : userId); | 251 | updateWrapper.set(ProductSampleConfirmationSlip::getQualityManager, StringUtil.isBlank(userId) ? null : userId); |
| 252 | updateWrapper.set(ProductSampleConfirmationSlip::getQualityManagerReview, StringUtil.isBlank(review) ? null : review); | 252 | updateWrapper.set(ProductSampleConfirmationSlip::getQualityManagerReview, StringUtil.isBlank(review) ? null : review); |
| 253 | updateWrapper.set(ProductSampleConfirmationSlip::getQualityManagerOpinion, StringUtil.isBlank(message) ? null : message); | 253 | updateWrapper.set(ProductSampleConfirmationSlip::getQualityManagerOpinion, StringUtil.isBlank(message) ? null : message); |
| 254 | updateWrapper.eq(ProductSampleConfirmationSlip::getId, id); | 254 | updateWrapper.eq(ProductSampleConfirmationSlip::getId, id); |
| 255 | - } else if (nodeCode.equals("confirmation_slip_6-")) { | 255 | + } else if (nodeCode.startsWith("confirmation_slip_6-")) { |
| 256 | //分厂主管 | 256 | //分厂主管 |
| 257 | updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisor, StringUtil.isBlank(userId) ? null : userId); | 257 | updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisor, StringUtil.isBlank(userId) ? null : userId); |
| 258 | updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisorReview, StringUtil.isBlank(review) ? null : review); | 258 | updateWrapper.set(ProductSampleConfirmationSlip::getBranchFactorySupervisorReview, StringUtil.isBlank(review) ? null : review); |
| @@ -3,7 +3,13 @@ package com.lframework.xingyun.sc.impl.sample; | @@ -3,7 +3,13 @@ package com.lframework.xingyun.sc.impl.sample; | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | import com.github.pagehelper.PageInfo; | 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.service.FlowInstanceWrapperService; | ||
| 9 | +import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo; | ||
| 6 | import com.lframework.starter.common.utils.CollectionUtil; | 10 | import com.lframework.starter.common.utils.CollectionUtil; |
| 11 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 12 | +import com.lframework.xingyun.sc.entity.ProductSampleConfirmationSlip; | ||
| 7 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; | 13 | import com.lframework.xingyun.sc.entity.SampleFeedbackTrackingDetail; |
| 8 | import com.lframework.xingyun.sc.entity.SampleResultTracking; | 14 | import com.lframework.xingyun.sc.entity.SampleResultTracking; |
| 9 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; | 15 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| @@ -19,6 +25,7 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; | @@ -19,6 +25,7 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; | ||
| 19 | import com.lframework.starter.common.utils.Assert; | 25 | import com.lframework.starter.common.utils.Assert; |
| 20 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 26 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 21 | import com.lframework.xingyun.sc.mappers.SampleFeedbackTrackingDetailMapper; | 27 | import com.lframework.xingyun.sc.mappers.SampleFeedbackTrackingDetailMapper; |
| 28 | +import org.apache.commons.collections.CollectionUtils; | ||
| 22 | import org.springframework.transaction.annotation.Transactional; | 29 | import org.springframework.transaction.annotation.Transactional; |
| 23 | import com.lframework.xingyun.sc.mappers.SampleResultTrackingMapper; | 30 | import com.lframework.xingyun.sc.mappers.SampleResultTrackingMapper; |
| 24 | import com.lframework.xingyun.sc.service.sample.SampleResultTrackingService; | 31 | import com.lframework.xingyun.sc.service.sample.SampleResultTrackingService; |
| @@ -29,11 +36,17 @@ import org.springframework.stereotype.Service; | @@ -29,11 +36,17 @@ import org.springframework.stereotype.Service; | ||
| 29 | 36 | ||
| 30 | import javax.annotation.Resource; | 37 | import javax.annotation.Resource; |
| 31 | import java.util.List; | 38 | import java.util.List; |
| 39 | +import java.util.stream.Collectors; | ||
| 32 | 40 | ||
| 33 | @Service | 41 | @Service |
| 34 | public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleResultTrackingMapper, SampleResultTracking> implements SampleResultTrackingService { | 42 | public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleResultTrackingMapper, SampleResultTracking> implements SampleResultTrackingService { |
| 43 | + private static final String BPM_FLAG = "RESULT_TRACKING"; | ||
| 35 | @Resource | 44 | @Resource |
| 36 | private SampleFeedbackTrackingDetailMapper sampleFeedbackTrackingDetailMapper; | 45 | private SampleFeedbackTrackingDetailMapper sampleFeedbackTrackingDetailMapper; |
| 46 | + @Resource | ||
| 47 | + private FlowInstanceWrapperService flowInstanceWrapperService; | ||
| 48 | + @Resource | ||
| 49 | + private FlowTaskWrapperMapper flowTaskWrapperMapper; | ||
| 37 | 50 | ||
| 38 | @Override | 51 | @Override |
| 39 | public PageResult<SampleResultTracking> query(Integer pageIndex, Integer pageSize, QuerySampleResultTrackingVo vo) { | 52 | public PageResult<SampleResultTracking> query(Integer pageIndex, Integer pageSize, QuerySampleResultTrackingVo vo) { |
| @@ -43,6 +56,19 @@ public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleRes | @@ -43,6 +56,19 @@ public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleRes | ||
| 43 | 56 | ||
| 44 | PageHelperUtil.startPage(pageIndex, pageSize); | 57 | PageHelperUtil.startPage(pageIndex, pageSize); |
| 45 | List<SampleResultTracking> datas = this.query(vo); | 58 | List<SampleResultTracking> datas = this.query(vo); |
| 59 | + // 获取当前人员的待办任务数据 | ||
| 60 | + List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId()); | ||
| 61 | + if (CollectionUtils.isEmpty(flowTaskList)) { | ||
| 62 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 63 | + } | ||
| 64 | + List<String> ids = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList()); | ||
| 65 | + for (SampleResultTracking sampleResultTracking : datas) { | ||
| 66 | + if (ids.contains(sampleResultTracking.getId())) { | ||
| 67 | + sampleResultTracking.setShowExamine(true); | ||
| 68 | + } else { | ||
| 69 | + sampleResultTracking.setShowExamine(false); | ||
| 70 | + } | ||
| 71 | + } | ||
| 46 | 72 | ||
| 47 | return PageResultUtil.convert(new PageInfo<>(datas)); | 73 | return PageResultUtil.convert(new PageInfo<>(datas)); |
| 48 | } | 74 | } |
| @@ -118,6 +144,9 @@ public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleRes | @@ -118,6 +144,9 @@ public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleRes | ||
| 118 | 144 | ||
| 119 | OpLogUtil.setVariable("id", data.getId()); | 145 | OpLogUtil.setVariable("id", data.getId()); |
| 120 | OpLogUtil.setExtra(vo); | 146 | OpLogUtil.setExtra(vo); |
| 147 | + //开启审核 | ||
| 148 | + SampleResultTracking result = getBaseMapper().findById(vo.getId()); | ||
| 149 | + flowInstanceWrapperService.startInstance(BPM_FLAG, result.getId(), BPM_FLAG, result); | ||
| 121 | } | 150 | } |
| 122 | 151 | ||
| 123 | @OpLog(type = OtherOpLogType.class, name = "删除产品试样结果跟踪单,ID:{}", params = {"#id"}) | 152 | @OpLog(type = OtherOpLogType.class, name = "删除产品试样结果跟踪单,ID:{}", params = {"#id"}) |
| @@ -127,4 +156,48 @@ public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleRes | @@ -127,4 +156,48 @@ public class SampleResultTrackingServiceImpl extends BaseMpServiceImpl<SampleRes | ||
| 127 | 156 | ||
| 128 | getBaseMapper().deleteById(id); | 157 | getBaseMapper().deleteById(id); |
| 129 | } | 158 | } |
| 159 | + | ||
| 160 | + @OpLog(type = OtherOpLogType.class, name = "修改状态,ID:{}", params = {"#id"}) | ||
| 161 | + @Transactional(rollbackFor = Exception.class) | ||
| 162 | + @Override | ||
| 163 | + public void updateStatus(String id, String status) { | ||
| 164 | + | ||
| 165 | + SampleResultTracking data = getBaseMapper().selectById(id); | ||
| 166 | + if (ObjectUtil.isNull(data)) { | ||
| 167 | + throw new DefaultClientException("产品试样结果跟踪单不存在!"); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + LambdaUpdateWrapper<SampleResultTracking> updateWrapper = Wrappers.lambdaUpdate(SampleResultTracking.class) | ||
| 171 | + .set(SampleResultTracking::getStatus, status) | ||
| 172 | + .eq(SampleResultTracking::getId, id); | ||
| 173 | + | ||
| 174 | + getBaseMapper().update(updateWrapper); | ||
| 175 | + | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + @Override | ||
| 179 | + public void updateExamine(String id, String nodeCode, String message) { | ||
| 180 | + SampleResultTracking data = getBaseMapper().selectById(id); | ||
| 181 | + if (ObjectUtil.isNull(data)) { | ||
| 182 | + throw new DefaultClientException("产品试样结果跟踪单不存在!"); | ||
| 183 | + } | ||
| 184 | + LambdaUpdateWrapper<SampleResultTracking> updateWrapper = Wrappers.lambdaUpdate(SampleResultTracking.class); | ||
| 185 | + if ("result_tracking_1".equals(nodeCode)) { | ||
| 186 | + updateWrapper.set(SampleResultTracking::getOfficeSupervisorOpinion, message); | ||
| 187 | + updateWrapper.eq(SampleResultTracking::getId, id); | ||
| 188 | + } else if (nodeCode.startsWith("result_tracking_2-")) { | ||
| 189 | + updateWrapper.set(SampleResultTracking::getQualitySupervisorOpinion, message); | ||
| 190 | + updateWrapper.eq(SampleResultTracking::getId, id); | ||
| 191 | + } else if (nodeCode.startsWith("result_tracking_3-")) { | ||
| 192 | + updateWrapper.set(SampleResultTracking::getQualityManagerOpinion, message); | ||
| 193 | + updateWrapper.eq(SampleResultTracking::getId, id); | ||
| 194 | + } else if (nodeCode.startsWith("result_tracking_4-")) { | ||
| 195 | + updateWrapper.set(SampleResultTracking::getOperationsDepartmentSupervisorOpinion, message); | ||
| 196 | + updateWrapper.eq(SampleResultTracking::getId, id); | ||
| 197 | + } else if (nodeCode.startsWith("result_tracking_5-")) { | ||
| 198 | + updateWrapper.set(SampleResultTracking::getMarketingDeputyDirectorOpinion, message); | ||
| 199 | + updateWrapper.eq(SampleResultTracking::getId, id); | ||
| 200 | + } | ||
| 201 | + getBaseMapper().update(updateWrapper); | ||
| 202 | + } | ||
| 130 | } | 203 | } |
| @@ -72,4 +72,21 @@ public interface SampleResultTrackingService extends BaseMpService<SampleResultT | @@ -72,4 +72,21 @@ public interface SampleResultTrackingService extends BaseMpService<SampleResultT | ||
| 72 | * @return | 72 | * @return |
| 73 | */ | 73 | */ |
| 74 | void deleteById(String id); | 74 | void deleteById(String id); |
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 修改状态 | ||
| 78 | + * | ||
| 79 | + * @param id 主键 | ||
| 80 | + * @param status 状态 | ||
| 81 | + */ | ||
| 82 | + void updateStatus(String id, String status); | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * 更新审核意见 | ||
| 86 | + * | ||
| 87 | + * @param id 主键 | ||
| 88 | + * @param nodeCode 节点 | ||
| 89 | + * @param message 审核意见 | ||
| 90 | + */ | ||
| 91 | + void updateExamine(String id, String nodeCode, String message); | ||
| 75 | } | 92 | } |
| @@ -4,6 +4,8 @@ | @@ -4,6 +4,8 @@ | ||
| 4 | 4 | ||
| 5 | <resultMap id="SampleResultTracking" type="com.lframework.xingyun.sc.entity.SampleResultTracking"> | 5 | <resultMap id="SampleResultTracking" type="com.lframework.xingyun.sc.entity.SampleResultTracking"> |
| 6 | <id column="id" property="id"/> | 6 | <id column="id" property="id"/> |
| 7 | + <result column="dept_id" property="deptId"/> | ||
| 8 | + <result column="dept_code" property="deptCode"/> | ||
| 7 | <result column="customer_id" property="customerId"/> | 9 | <result column="customer_id" property="customerId"/> |
| 8 | <result column="customer_name" property="customerName"/> | 10 | <result column="customer_name" property="customerName"/> |
| 9 | <result column="workshop_id" property="workshopId"/> | 11 | <result column="workshop_id" property="workshopId"/> |
| @@ -40,6 +42,8 @@ | @@ -40,6 +42,8 @@ | ||
| 40 | <sql id="SampleResultTracking_sql"> | 42 | <sql id="SampleResultTracking_sql"> |
| 41 | SELECT | 43 | SELECT |
| 42 | tb.id, | 44 | tb.id, |
| 45 | + tb.dept_id, | ||
| 46 | + sd.code AS dept_code, | ||
| 43 | tb.customer_id, | 47 | tb.customer_id, |
| 44 | cu.name AS customer_name, | 48 | cu.name AS customer_name, |
| 45 | tb.workshop_id, | 49 | tb.workshop_id, |
| @@ -75,6 +79,7 @@ | @@ -75,6 +79,7 @@ | ||
| 75 | left join base_data_customer as cu on cu.id = tb.customer_id | 79 | left join base_data_customer as cu on cu.id = tb.customer_id |
| 76 | left join base_data_workshop as ws on ws.id = tb.workshop_id | 80 | left join base_data_workshop as ws on ws.id = tb.workshop_id |
| 77 | left join purchase_order_info as poi on poi.id = tb.order_id | 81 | left join purchase_order_info as poi on poi.id = tb.order_id |
| 82 | + left join sys_dept as sd on sd.id = tb.dept_id | ||
| 78 | </sql> | 83 | </sql> |
| 79 | 84 | ||
| 80 | <select id="query" resultMap="SampleResultTracking"> | 85 | <select id="query" resultMap="SampleResultTracking"> |
No preview for this file type