Merge remote-tracking branch 'origin/master'
| | |
| | | "avatar": "", |
| | | "version": "4.9.2", |
| | | "createdTime": "2025-3-10 16:38:19", |
| | | "updatedTime": "2025-5-20 16:52:50", |
| | | "updatedTime": "2025-5-22 15:02:23", |
| | | "dbConns": [], |
| | | "profile": { |
| | | "default": { |
| | |
| | | "extProps": {}, |
| | | "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", |
| | | "id": "00B8A82A-3C40-4DA3-927F-D5F8460E2A72" |
| | | }, |
| | | { |
| | | "defKey": "spare_part_into_type", |
| | | "defName": "å¤ä»¶åºå
¥åºç±»å", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792", |
| | | "id": "7EB4AF36-3551-4569-A5F7-F7D65AE872A6" |
| | | } |
| | | ], |
| | | "correlations": [], |
| | |
| | | "id": "0B8261B7-C8DA-4A5E-910D-9F86FFE80053" |
| | | }, |
| | | { |
| | | "defKey": "inventory_id", |
| | | "defName": "åºåID", |
| | | "defKey": "spare_parts_id", |
| | | "defName": "å¤ä»¶ID", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | |
| | | String THIRD_MAINTENANCE_CODE_RULE = "ThirdMaintenanceCodeRule"; |
| | | //设å¤ååºå½è¿ |
| | | String LEAN_OUT_CODE_RULE = "EquipmentLeanOutCodeRule"; |
| | | //设å¤å°åå¯å° |
| | | String SEAL_UP_CODE_RULE = "EquipmentSealUpCodeRule"; |
| | | /** |
| | | * å¤ä»¶è¯·è´åç¶æ 1:å·²å建 2:å·²æäº¤ 3:å·²éè¿ 4:已驳å 5:已宿 |
| | | */ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.constant; |
| | | |
| | | /** |
| | | * @author cuikaidong |
| | | * @date 2025/5/22 |
| | | */ |
| | | public enum EquipmentSealUpStatusEnum { |
| | | WAIT_SUBMIT, //å¾
æäº¤ |
| | | WAIT_CHECK, //å¾
å®¡æ ¸ |
| | | SEALED, //å·²å°å |
| | | COMPLETE, //已宿 |
| | | ; |
| | | |
| | | public static EquipmentSealUpStatusEnum getInstance(String code) { |
| | | EquipmentSealUpStatusEnum[] values = EquipmentSealUpStatusEnum.values(); |
| | | for (EquipmentSealUpStatusEnum value : values) { |
| | | if (value.name().equals(code)) { |
| | | return value; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLDecoder; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentSealUpService; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.EquipmentSealUpStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import org.jeecg.modules.eam.request.EamEquipmentSealUpQuery; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentSealUpService; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 设å¤å°åå¯å° |
| | |
| | | public class EamEquipmentSealUpController extends JeecgController<EamEquipmentSealUp, IEamEquipmentSealUpService> { |
| | | @Autowired |
| | | private IEamEquipmentSealUpService eamEquipmentSealUpService; |
| | | @Autowired |
| | | private ISysBusinessCodeRuleService businessCodeRuleService; |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | @Autowired |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param eamEquipmentSealUp |
| | | * @param query |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | |
| | | @AutoLog(value = "设å¤å°åå¯å°-å页å表æ¥è¯¢") |
| | | @ApiOperation(value="设å¤å°åå¯å°-å页å表æ¥è¯¢", notes="设å¤å°åå¯å°-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(EamEquipmentSealUp eamEquipmentSealUp, |
| | | public Result<?> queryPageList(EamEquipmentSealUpQuery query, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<EamEquipmentSealUp> queryWrapper = QueryGenerator.initQueryWrapper(eamEquipmentSealUp, req.getParameterMap()); |
| | | Page<EamEquipmentSealUp> page = new Page<EamEquipmentSealUp>(pageNo, pageSize); |
| | | IPage<EamEquipmentSealUp> pageList = eamEquipmentSealUpService.page(page, queryWrapper); |
| | | IPage<EamEquipmentSealUp> pageList = eamEquipmentSealUpService.queryPageList(page, query); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param eamEquipmentSealUp |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤å°åå¯å°-æ·»å ") |
| | | @ApiOperation(value="设å¤å°åå¯å°-æ·»å ", notes="设å¤å°åå¯å°-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamEquipmentSealUp eamEquipmentSealUp) { |
| | | eamEquipmentSealUpService.save(eamEquipmentSealUp); |
| | | public Result<?> add(@RequestBody EamEquipmentSealUp request) { |
| | | if (request == null) { |
| | | return Result.error("æ·»å ç对象ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | request.setCode(businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.SEAL_UP_CODE_RULE)); |
| | | request.setSealStatus(EquipmentSealUpStatusEnum.WAIT_SUBMIT.name()); |
| | | request.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | boolean b = eamEquipmentSealUpService.addSealUp(request); |
| | | if (!b) { |
| | | return Result.error("æ·»å 失败ï¼"); |
| | | } |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param eamEquipmentSealUp |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤å°åå¯å°-ç¼è¾") |
| | | @ApiOperation(value="设å¤å°åå¯å°-ç¼è¾", notes="设å¤å°åå¯å°-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody EamEquipmentSealUp eamEquipmentSealUp) { |
| | | eamEquipmentSealUpService.updateById(eamEquipmentSealUp); |
| | | public Result<?> edit(@RequestBody EamEquipmentSealUp request) { |
| | | if (request == null) { |
| | | return Result.error("ç¼è¾ç对象ä¸è½ä¸ºç©ºï¼"); |
| | | } |
| | | boolean b = eamEquipmentSealUpService.editSealUp(request); |
| | | if (!b) { |
| | | return Result.error("ç¼è¾å¤±è´¥ï¼"); |
| | | } |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value="设å¤å°åå¯å°-éè¿idå é¤", notes="设å¤å°åå¯å°-éè¿idå é¤") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
| | | eamEquipmentSealUpService.removeById(id); |
| | | EamEquipmentSealUp entity = eamEquipmentSealUpService.getById(id); |
| | | if (entity != null) { |
| | | entity.setDelFlag(CommonConstant.DEL_FLAG_1); |
| | | eamEquipmentSealUpService.updateById(entity); |
| | | } |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value="设å¤å°åå¯å°-æ¹éå é¤", notes="设å¤å°åå¯å°-æ¹éå é¤") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.eamEquipmentSealUpService.removeByIds(Arrays.asList(ids.split(","))); |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | list.forEach(id -> { |
| | | EamEquipmentSealUp entity = eamEquipmentSealUpService.getById(id); |
| | | if (entity != null) { |
| | | entity.setDelFlag(CommonConstant.DEL_FLAG_1); |
| | | eamEquipmentSealUpService.updateById(entity); |
| | | } |
| | | }); |
| | | return Result.OK("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
| | | EamEquipmentSealUp eamEquipmentSealUp = eamEquipmentSealUpService.getById(id); |
| | | return Result.OK(eamEquipmentSealUp); |
| | | if (eamEquipmentSealUp == null) { |
| | | return Result.error("æªæ¾å°å¯¹åºæ°æ®"); |
| | | } |
| | | try { |
| | | String json = objectMapper.writeValueAsString(eamEquipmentSealUp); |
| | | JSONObject item = JSONObject.parseObject(json, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("reportUser", eamEquipmentSealUp.getReportUser(), item, "sys_user,realname,username"); |
| | | return Result.OK(item); |
| | | } catch (JsonProcessingException e) { |
| | | return Result.error("æ°æ®è½¬è¯å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * æäº¤ |
| | | * |
| | | * @param request |
| | | * @param eamEquipmentSealUp |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, EamEquipmentSealUp eamEquipmentSealUp) { |
| | | return super.exportXls(request, eamEquipmentSealUp, EamEquipmentSealUp.class, "设å¤å°åå¯å°"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, EamEquipmentSealUp.class); |
| | | @AutoLog(value = "设å¤å°åå¯å°-æäº¤") |
| | | @ApiOperation(value = "设å¤å°åå¯å°-æäº¤", notes = "设å¤å°åå¯å°-æäº¤") |
| | | @GetMapping(value = "/submit") |
| | | public Result<?> submit(@RequestParam(name = "id", required = true) String id) { |
| | | boolean b = eamEquipmentSealUpService.submit(id); |
| | | if (!b) { |
| | | return Result.error("æä½å¤±è´¥ï¼"); |
| | | } |
| | | |
| | | return Result.OK("æä½æå!"); |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | @ApiOperation(value = "å¤ä»¶åºåä¿¡æ¯-æ·»å ", notes = "å¤ä»¶åºåä¿¡æ¯-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamSparePartInventory eamSparePartInventory) { |
| | | eamSparePartInventoryService.save(eamSparePartInventory); |
| | | List<EamSparePartInventory> eamSparePartInventories = eamSparePartInventory.getEamSparePartInventories(); |
| | | for (EamSparePartInventory sparePartInventory : eamSparePartInventories) { |
| | | eamSparePartInventoryService.save(sparePartInventory); |
| | | } |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.modules.eam.entity.EamSparePartInventory; |
| | | import org.jeecg.modules.eam.entity.EamSpareParts; |
| | | import org.jeecg.modules.eam.service.IEamSparePartInventoryService; |
| | | import org.jeecg.modules.eam.service.IEamSparePartsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | @Resource |
| | | private IEamSparePartsService eamSparePartsService; |
| | | |
| | | @Autowired |
| | | private IEamSparePartInventoryService eamSparePartInventoryService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | |
| | | QueryWrapper<EamSpareParts> queryWrapper = QueryGenerator.initQueryWrapper(eamSpareParts, req.getParameterMap()); |
| | | Page<EamSpareParts> page = new Page<EamSpareParts>(pageNo, pageSize); |
| | | IPage<EamSpareParts> pageList = eamSparePartsService.page(page, queryWrapper); |
| | | for (EamSpareParts record : pageList.getRecords()) { |
| | | QueryWrapper<EamSparePartInventory> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("spare_part_id",record.getId()).select("sum(inventory) as inventory"); |
| | | EamSparePartInventory one = eamSparePartInventoryService.getOne(wrapper); |
| | | record.setTotalQuantity(one.getInventory().toString()); |
| | | } |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | /**ç³è¯·äºº*/ |
| | | @Excel(name = "ç³è¯·äºº", width = 15) |
| | | @ApiModelProperty(value = "ç³è¯·äºº") |
| | | @Dict(dicCode = "sys_user, realname, username") |
| | | private String reportUser; |
| | | /**å°åå¼å§æ¶é´*/ |
| | | @ApiModelProperty(value = "å°åå¼å§æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date sealStartTime; |
| | | /**å°åç»ææ¶é´*/ |
| | | @ApiModelProperty(value = "å°åç»ææ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date sealEndTime; |
| | | /**å°ååå */ |
| | | @Excel(name = "å°ååå ", width = 15) |
| | |
| | | /**å°åç¶æ*/ |
| | | @Excel(name = "å°åç¶æ", width = 15) |
| | | @ApiModelProperty(value = "å°åç¶æ") |
| | | @Dict(dicCode = "equipment_seal_up_status") |
| | | private String sealStatus; |
| | | /**å®¡æ ¸äºº*/ |
| | | @Excel(name = "å®¡æ ¸äºº", width = 15) |
| | |
| | | private String approvalUser; |
| | | /**å®¡æ ¸æ¶é´*/ |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date approvalTime; |
| | | /**夿³¨*/ |
| | | @Excel(name = "夿³¨", width = 15) |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | //å表å±ç¤º |
| | | @TableField(exist = false) |
| | | private String equipmentCode; |
| | | @TableField(exist = false) |
| | | private String equipmentName; |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: å¤ä»¶åºåä¿¡æ¯ |
| | |
| | | @Excel(name = "å¤åå¤ä»¶ID", width = 15) |
| | | @ApiModelProperty(value = "å¤åå¤ä»¶ID") |
| | | private String sparePartId; |
| | | |
| | | /** |
| | | * æ¥æºç±»å |
| | | */ |
| | | @Excel(name = "å¤ä»¶æ¥æºç±»å", width = 15) |
| | | @ApiModelProperty(value = "å¤ä»¶æ¥æºç±»å") |
| | | @Dict(dicCode = "spare_part_into_type") |
| | | private String sparePartIntoType; |
| | | /** |
| | | * æ¹æ¬¡å· |
| | | */ |
| | |
| | | @Excel(name = "åæ¾ä½ç½®", width = 15) |
| | | @ApiModelProperty(value = "åæ¾ä½ç½®") |
| | | private String location; |
| | | |
| | | @TableField(exist = false) |
| | | private List<EamSparePartInventory> eamSparePartInventories; |
| | | } |
| | |
| | | package org.jeecg.modules.eam.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | |
| | | * å 餿 è®° |
| | | */ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | private Integer delFlag; |
| | | @JsonIgnore |
| | | @ApiModelProperty(value = "å é¤ç¶æ(0-æ£å¸¸,1-å·²å é¤)", hidden = true) |
| | | @TableLogic |
| | | private Integer delFlag = CommonConstant.DEL_FLAG_0; |
| | | /** |
| | | * å¤ä»¶ç¼ç |
| | | */ |
| | |
| | | */ |
| | | @Excel(name = "å¤ä»¶åç±»", width = 15) |
| | | @ApiModelProperty(value = "å¤ä»¶åç±»") |
| | | @Dict(dicCode = "spare_part_category") |
| | | private String partCategory; |
| | | /** |
| | | * å¤ä»¶åå· |
| | |
| | | @Excel(name = "夿³¨", width = 15) |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | |
| | | /** |
| | | * åºåæ»æ°é |
| | | */ |
| | | @TableField(exist = false) |
| | | private String totalQuantity; |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentLeanOut; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface EamEquipmentSealUpMapper extends BaseMapper<EamEquipmentSealUp> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param queryWrapper |
| | | * @return |
| | | */ |
| | | IPage<EamEquipmentSealUp> queryPageList(Page<EamEquipmentSealUp> page, @Param(Constants.WRAPPER) QueryWrapper<EamEquipmentSealUp> queryWrapper); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.eam.mapper.EamEquipmentSealUpMapper"> |
| | | |
| | | <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamEquipmentSealUp"> |
| | | select wmo.*, e.equipment_code, e.equipment_name |
| | | from eam_equipment_seal_up wmo |
| | | inner join eam_equipment e |
| | | on wmo.equipment_id = e.id |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.request; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class EamEquipmentSealUpQuery { |
| | | private String code; |
| | | private String equipmentId; |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date leanDateBegin; |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date leanDateEnd; |
| | | private String sealStatus; |
| | | |
| | | private String column; |
| | | private String order; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.request; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Description: 设å¤å°åå¯å° |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-05-13 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class EamEquipmentSealUpRequest extends FlowTaskVo implements Serializable { |
| | | |
| | | /**主é®*/ |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /**å建人*/ |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | /**å建æ¶é´*/ |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | /**æ´æ°äºº*/ |
| | | @ApiModelProperty(value = "æ´æ°äºº") |
| | | private String updateBy; |
| | | /**æ´æ°æ¶é´*/ |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private Date updateTime; |
| | | /**å 餿 è®°*/ |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | private Integer delFlag; |
| | | /**设å¤ID*/ |
| | | @ApiModelProperty(value = "设å¤ID") |
| | | private String equipmentId; |
| | | /**åæ®å·*/ |
| | | @ApiModelProperty(value = "åæ®å·") |
| | | private String code; |
| | | /**ç³è¯·äºº*/ |
| | | @ApiModelProperty(value = "ç³è¯·äºº") |
| | | private String reportUser; |
| | | /**å°åå¼å§æ¶é´*/ |
| | | @ApiModelProperty(value = "å°åå¼å§æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date sealStartTime; |
| | | /**å°åç»ææ¶é´*/ |
| | | @ApiModelProperty(value = "å°åç»ææ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date sealEndTime; |
| | | /**å°ååå */ |
| | | @ApiModelProperty(value = "å°ååå ") |
| | | private String sealUpReason; |
| | | /**å°åç¶æ*/ |
| | | @ApiModelProperty(value = "å°åç¶æ") |
| | | @Dict(dicCode = "equipment_seal_up_status") |
| | | private String sealStatus; |
| | | /**å®¡æ ¸äºº*/ |
| | | @ApiModelProperty(value = "å®¡æ ¸äºº") |
| | | private String approvalUser; |
| | | /**å®¡æ ¸æ¶é´*/ |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date approvalTime; |
| | | /**夿³¨*/ |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | } |
| | |
| | | package org.jeecg.modules.eam.service; |
| | | |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import org.jeecg.modules.eam.request.EamEquipmentSealUpQuery; |
| | | import org.jeecg.modules.eam.request.EamEquipmentSealUpRequest; |
| | | |
| | | /** |
| | | * @Description: 设å¤å°åå¯å° |
| | |
| | | */ |
| | | public interface IEamEquipmentSealUpService extends IService<EamEquipmentSealUp> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param page |
| | | * @param query |
| | | * @return |
| | | */ |
| | | IPage<EamEquipmentSealUp> queryPageList(Page<EamEquipmentSealUp> page, EamEquipmentSealUpQuery query); |
| | | |
| | | /** |
| | | * æ·»å å°åè®°å½ |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | boolean addSealUp(EamEquipmentSealUp request); |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | boolean editSealUp(EamEquipmentSealUp request); |
| | | |
| | | /** |
| | | * æäº¤ç³è¯· |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | boolean submit(String id); |
| | | |
| | | /** |
| | | * å®¡æ¹æµç¨æ§å¶ |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | | EamEquipmentSealUp approval(EamEquipmentSealUpRequest request); |
| | | } |
| | |
| | | package org.jeecg.modules.eam.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.flowable.engine.TaskService; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.constant.DataBaseConstant; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.constant.AssetStatusEnum; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.EquipmentLeanOutStatusEnum; |
| | | import org.jeecg.modules.eam.constant.EquipmentSealUpStatusEnum; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentSealUp; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentSealUpMapper; |
| | | import org.jeecg.modules.eam.request.EamEquipmentSealUpQuery; |
| | | import org.jeecg.modules.eam.request.EamEquipmentSealUpRequest; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentSealUpService; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.vo.UserSelector; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: 设å¤å°åå¯å° |
| | |
| | | * @Date: 2025-05-13 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class EamEquipmentSealUpServiceImpl extends ServiceImpl<EamEquipmentSealUpMapper, EamEquipmentSealUp> implements IEamEquipmentSealUpService { |
| | | @Service("IEamEquipmentSealUpService") |
| | | public class EamEquipmentSealUpServiceImpl extends ServiceImpl<EamEquipmentSealUpMapper, EamEquipmentSealUp> implements IEamEquipmentSealUpService, FlowCallBackServiceI { |
| | | |
| | | @Resource |
| | | private EamEquipmentSealUpMapper equipmentSealUpMapper; |
| | | @Autowired |
| | | private IEamEquipmentService eamEquipmentService; |
| | | @Autowired |
| | | private FlowCommonService flowCommonService; |
| | | @Autowired |
| | | private IFlowDefinitionService flowDefinitionService; |
| | | @Autowired |
| | | private IFlowMyBusinessService flowMyBusinessService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private IFlowTaskService flowTaskService; |
| | | |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | @Override |
| | | public IPage<EamEquipmentSealUp> queryPageList(Page<EamEquipmentSealUp> page, EamEquipmentSealUpQuery query) { |
| | | QueryWrapper<EamEquipmentSealUp> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("wmo.del_flag", CommonConstant.DEL_FLAG_0); |
| | | //ç¨æ·æ°æ®æé |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return page; |
| | | } |
| | | if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | //éæ©äºè®¾å¤ï¼æ ¹æ®è®¾å¤idè¿æ»¤è®¾å¤ |
| | | List<String> equipArr = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | //没æéæ©è®¾å¤ï¼æ ¹æ®è½¦é´è¿æ»¤è®¾å¤ |
| | | queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=e.org_id ", sysUser.getId()); |
| | | } |
| | | //æ§å¶å¾
æäº¤ç¶æçæ°æ®åªè½æ¬äººæ¥ç |
| | | queryWrapper.and(i -> i.ne("wmo.seal_status", EquipmentSealUpStatusEnum.WAIT_SUBMIT).or().eq("wmo.report_user", sysUser.getUsername())); |
| | | //æ¥è¯¢æ¡ä»¶è¿æ»¤ |
| | | if (query != null) { |
| | | if (StringUtils.isNotBlank(query.getEquipmentId())) { |
| | | queryWrapper.eq("wmo.equipment_id", query.getEquipmentId()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getCode())) { |
| | | queryWrapper.like("wmo.code", query.getCode()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getSealStatus())) { |
| | | queryWrapper.eq("wmo.seal_status", query.getSealStatus()); |
| | | } |
| | | if (query.getLeanDateBegin() != null && query.getLeanDateEnd() != null) { |
| | | queryWrapper.between("wmo.lean_start_time", query.getLeanDateBegin(), query.getLeanDateEnd()); |
| | | } |
| | | //æåº |
| | | if (StringUtils.isNotBlank(query.getColumn()) && StringUtils.isNotBlank(query.getOrder())) { |
| | | String column = query.getColumn(); |
| | | if (column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) { |
| | | column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX)); |
| | | } |
| | | if (DataBaseConstant.SQL_ASC.equalsIgnoreCase(query.getOrder())) { |
| | | queryWrapper.orderByAsc("wmo." + oConvertUtils.camelToUnderline(column)); |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo." + oConvertUtils.camelToUnderline(column)); |
| | | } |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | } |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | } |
| | | |
| | | return equipmentSealUpMapper.queryPageList(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean addSealUp(EamEquipmentSealUp request) { |
| | | //æ£æ¥è®¾å¤ |
| | | EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId()); |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼"); |
| | | } |
| | | if (!AssetStatusEnum.NORMAL.name().equals(equipment.getAssetStatus())) { |
| | | throw new JeecgBootException("æ¤è®¾å¤å½åèµäº§ç¶æä¸å
许ååºï¼"); |
| | | } |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("å½åç¨æ·æ æ³æ·»å åç¨è®°å½ï¼"); |
| | | } |
| | | request.setReportUser(sysUser.getUsername()); |
| | | return equipmentSealUpMapper.insert(request) > 0; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean editSealUp(EamEquipmentSealUp request) { |
| | | EamEquipmentSealUp entity = equipmentSealUpMapper.selectById(request.getId()); |
| | | if (entity == null) { |
| | | throw new JeecgBootException("è¦ç¼è¾çæ°æ®ä¸åå¨ï¼è¯·å·æ°éè¯ï¼"); |
| | | } |
| | | if (!EquipmentSealUpStatusEnum.WAIT_SUBMIT.name().equals(entity.getSealStatus())) { |
| | | throw new JeecgBootException("å½åæ°æ®ç¶æä¸å
许ç¼è¾ï¼"); |
| | | } |
| | | //æ£æ¥è®¾å¤ |
| | | EamEquipment equipment = eamEquipmentService.getById(request.getEquipmentId()); |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼"); |
| | | } |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("å½åç¨æ·æ æ³ç¼è¾åç¨è®°å½ï¼"); |
| | | } |
| | | UpdateWrapper<EamEquipmentSealUp> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("equipment_id", request.getEquipmentId()); |
| | | updateWrapper.set("remark", request.getRemark()); |
| | | updateWrapper.set("seal_up_reason", request.getSealUpReason()); |
| | | updateWrapper.eq("id", request.getId()); |
| | | updateWrapper.eq("report_user", sysUser.getUsername()); |
| | | return super.update(updateWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean submit(String id) { |
| | | EamEquipmentSealUp entity = equipmentSealUpMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw new JeecgBootException("è¦æäº¤çæ°æ®ä¸åå¨ï¼è¯·å·æ°éè¯ï¼"); |
| | | } |
| | | if (!EquipmentLeanOutStatusEnum.WAIT_SUBMIT.name().equals(entity.getSealStatus())) { |
| | | throw new JeecgBootException("å½åæ°æ®ç¶æä¸å
许ç¼è¾ï¼"); |
| | | } |
| | | //æ£æ¥è®¾å¤ |
| | | EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId()); |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设å¤ä¸åå¨ï¼"); |
| | | } |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("å½åç¨æ·æ æ³ç¼è¾å°åè®°å½ï¼"); |
| | | } |
| | | UpdateWrapper<EamEquipmentSealUp> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("seal_status", EquipmentSealUpStatusEnum.WAIT_SUBMIT.name()); |
| | | updateWrapper.eq("id", id); |
| | | updateWrapper.eq("report_user", sysUser.getUsername()); |
| | | boolean success = super.update(updateWrapper); |
| | | if (success) { |
| | | equipment.setAssetStatus(AssetStatusEnum.SEAL_UP.name()); // 设å¤å°å |
| | | eamEquipmentService.updateById(equipment); |
| | | } |
| | | //å¯å¨å®¡æ¹æµç¨ |
| | | flowCommonService.initActBusiness("å·¥åå·:" + entity.getCode() + ";设å¤ç¼å·: " + equipment.getEquipmentCode() + ";è¿è¡è®¾å¤å°å", |
| | | entity.getId(), "IEamEquipmentSealUpService", "equipment_seal_up", null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", entity.getId()); |
| | | if (StrUtil.isEmpty(entity.getSealUpReason())) { |
| | | variables.put("organization", "æ°å¢å°åé»è®¤å¯å¨æµç¨"); |
| | | variables.put("comment", "æ°å¢å°åå·¥åé»è®¤å¯å¨æµç¨"); |
| | | } else { |
| | | variables.put("organization", entity.getSealUpReason()); |
| | | variables.put("comment", entity.getSealUpReason()); |
| | | } |
| | | variables.put("proofreading", true); |
| | | // åé
ç»è®¾å¤ç®¡çå |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0004); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("è®¾å¤æªåé
ç»è®¾å¤ç®¡çåï¼æ æ³è¿å
¥ä¸çº§å®¡æ¹ï¼"); |
| | | } |
| | | List<String> usernames = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | variables.put("NextAssignee", usernames); |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("equipment_seal_up", variables); |
| | | if (result != null) { |
| | | entity.setSealStartTime(new Date()); |
| | | entity.setSealStatus(EquipmentSealUpStatusEnum.WAIT_CHECK.name()); |
| | | //ä¿åå·¥å |
| | | equipmentSealUpMapper.updateById(entity); |
| | | return result.isSuccess(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public EamEquipmentSealUp approval(EamEquipmentSealUpRequest request) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | | business.getTaskNameId();//æ¥ä¸æ¥å®¡æ¹çèç¹ |
| | | business.getValues();//åç«¯ä¼ è¿æ¥çåæ° |
| | | business.getActStatus(); |
| | | } |
| | | |
| | | @Override |
| | | public Object getBusinessDataById(String dataId) { |
| | | return this.getById(dataId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.tms.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto; |
| | | import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto; |
| | | import org.jeecg.modules.tms.entity.vo.OutboundDetailVo; |
| | | import org.jeecg.modules.tms.enums.OutBillStatus; |
| | |
| | | @Autowired |
| | | private IOutboundDetailService outboundDetailService; |
| | | |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @Autowired |
| | | private TranslateDictTextUtils translateDictTextUtils; |
| | | |
| | | |
| | | |
| | | /*---------------------------------主表å¤ç-begin-------------------------------------*/ |
| | | |
| | |
| | | Page<OutboundOrder> page = new Page<OutboundOrder>(pageNo, pageSize); |
| | | IPage<OutboundOrder> pageList = outboundOrderService.queryPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | @ApiOperation(value="tms_outbound_order-éè¿idæ¥è¯¢", notes="tms_outbound_order-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam("id") String id) { |
| | | OutboundOrder outboundOrder = outboundOrderService.getById(id); |
| | | if (outboundOrder == null) { |
| | | return Result.error("æªæ¾å°å¯¹åºæ°æ®"); |
| | | } |
| | | try { |
| | | String jsonStr = objectMapper.writeValueAsString(outboundOrder); |
| | | JSONObject item = JSONObject.parseObject(jsonStr, Feature.OrderedField); |
| | | translateDictTextUtils.translateField("outStorehouseType", outboundOrder.getOutStorehouseType(), item, "out_storehouse_type"); |
| | | translateDictTextUtils.translateField("handler", outboundOrder.getHandler(), item, "sys_user,realname,id"); |
| | | translateDictTextUtils.translateField("orderStatus", outboundOrder.getOrderStatus(), item, "out_bill_status"); |
| | | translateDictTextUtils.translateField("outStatus", outboundOrder.getOutStatus(), item, "out_storehouse_status"); |
| | | translateDictTextUtils.translateField("createBy", outboundOrder.getCreateBy(), item, "sys_user,realname,username"); |
| | | translateDictTextUtils.translateField("updateBy", outboundOrder.getUpdateBy(), item, "sys_user,realname,username"); |
| | | return Result.OK(item); |
| | | } catch (JsonProcessingException e) { |
| | | return Result.error("æ°æ®è½¬è¯å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value="tms_outbound_order-æäº¤åºåºç³è¯·å", notes="tms_outbound_order-æäº¤åºåºç³è¯·å") |
| | | @GetMapping(value = "/submit") |
| | | public Result<String> submit(@RequestParam(name="id") String id) { |
| | | OutboundOrder order = new OutboundOrder(); |
| | | order.setId(id); |
| | | order.setOrderStatus(OutBillStatus.SUBMITTED.getValue()); |
| | | outboundOrderService.updateById(order); |
| | | //å¼å¯æµç¨ |
| | | outboundOrderService.submit(id); |
| | | return Result.OK("æäº¤æå!"); |
| | | } |
| | | |
| | | @AutoLog(value = "å®¡æ¹æµç¨") |
| | | @ApiOperation(value = "åºåºç³è¯·å-å®¡æ¹æµç¨", notes = "åºåºç³è¯·å-å®¡æ¹æµç¨") |
| | | @PostMapping("/approval") |
| | | public Result<?> approval(@RequestBody OutBoundOrderFlowDto outBoundOrderFlowDto) { |
| | | outboundOrderService.approvalProcess(outBoundOrderFlowDto); |
| | | return Result.OK("æä½æå"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idå é¤ |
| | | * @param id |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.tms.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; |
| | | |
| | | @Data |
| | | public class OutBoundOrderFlowDto extends FlowTaskVo { |
| | | //审æ¹ç¶æ |
| | | private String status; |
| | | //å®¡æ¹æè§ |
| | | private String approvalOpinion; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.tms.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * åºåºç¶ææä¸¾ |
| | | */ |
| | | @Getter |
| | | public enum OutBoundStatusEnum { |
| | | /** |
| | | * æªåºåº |
| | | */ |
| | | NOT_OUTBOUND("1", "æªåºåº"), |
| | | |
| | | /** |
| | | * é¨ååºåº |
| | | */ |
| | | PARTIAL_OUTBOUND("2", "é¨ååºåº"), |
| | | |
| | | /** |
| | | * åºåºå®æ |
| | | */ |
| | | COMPLETED("3", "åºåºå®æ"); |
| | | |
| | | private final String value; |
| | | private final String description; |
| | | |
| | | OutBoundStatusEnum(String value, String description) { |
| | | this.value = value; |
| | | this.description = description; |
| | | } |
| | | } |
| | |
| | | import org.jeecg.modules.tms.entity.OutboundDetail; |
| | | import org.jeecg.modules.tms.entity.OutboundOrder; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto; |
| | | import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import java.io.Serializable; |
| | |
| | | IPage<OutboundOrder> queryPageList(Page<OutboundOrder> page, Map<String, String[]> parameterMap); |
| | | |
| | | void editTotal(OutboundOrderAndDetailDto outboundOrder); |
| | | |
| | | void submit(String id); |
| | | |
| | | void approvalProcess(OutBoundOrderFlowDto outBoundOrderFlowDto); |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.task.api.Task; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.jeecg.modules.tms.entity.OutboundOrder; |
| | | import org.jeecg.modules.tms.entity.OutboundDetail; |
| | | import org.jeecg.modules.tms.entity.dto.OutBoundOrderFlowDto; |
| | | import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto; |
| | | import org.jeecg.modules.tms.enums.OutBillStatus; |
| | | import org.jeecg.modules.tms.enums.OutBoundStatusEnum; |
| | | import org.jeecg.modules.tms.mapper.OutboundDetailMapper; |
| | | import org.jeecg.modules.tms.mapper.OutboundOrderMapper; |
| | | import org.jeecg.modules.tms.service.IOutboundDetailService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: tms_outbound_order |
| | |
| | | * @Date: 2025-05-16 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class OutboundOrderServiceImpl extends ServiceImpl<OutboundOrderMapper, OutboundOrder> implements IOutboundOrderService { |
| | | public class OutboundOrderServiceImpl extends ServiceImpl<OutboundOrderMapper, OutboundOrder> implements IOutboundOrderService, FlowCallBackServiceI { |
| | | |
| | | @Autowired |
| | | private IOutboundDetailService outboundDetailService; |
| | | @Autowired |
| | | private ISysBusinessCodeRuleService businessCodeRuleService; |
| | | @Autowired |
| | | private IFlowDefinitionService flowDefinitionService; |
| | | @Autowired |
| | | private IFlowMyBusinessService flowMyBusinessService; |
| | | @Autowired |
| | | private IFlowTaskService flowTaskService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private FlowCommonService flowCommonService; |
| | | @Autowired |
| | | private OutboundOrderMapper outboundOrderMapper; |
| | | @Autowired |
| | |
| | | save(order); |
| | | List<OutboundDetail> detailList = CollectionUtil.newArrayList(); |
| | | outboundOrder.getOutboundDetailList().forEach(item->{ |
| | | item.setId(null); |
| | | item.setOutStorehouseId(order.getId()); |
| | | detailList.add(item); |
| | | }); |
| | |
| | | outboundDetailService.saveBatch(detailList); |
| | | } |
| | | |
| | | @Override |
| | | public void submit(String id) { |
| | | OutboundOrder outboundOrder = getById(id); |
| | | if (outboundOrder == null) { |
| | | throw new JeecgBootException("åºåºåç³è¯·åä¸åå¨ï¼æ æ³æäº¤ï¼"); |
| | | } |
| | | if (!Objects.equals(outboundOrder.getOrderStatus(), OutBillStatus.DRAFT.getValue())) { |
| | | throw new JeecgBootException("æ æ³æäº¤éèç¨¿ç¶æçåºåºç³è¯·åï¼"); |
| | | } |
| | | //å¯å¨æµç¨ |
| | | if (triggerProcess(outboundOrder)) { |
| | | outboundOrder.setOrderStatus(OutBillStatus.SUBMITTED.getValue()); |
| | | } |
| | | updateById(outboundOrder); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void approvalProcess(OutBoundOrderFlowDto outBoundOrderFlowDto) { |
| | | if (StrUtil.isBlank(outBoundOrderFlowDto.getTaskId()) || StrUtil.isBlank(outBoundOrderFlowDto.getDataId())) { |
| | | throw new JeecgBootException("鿳忰ï¼"); |
| | | } |
| | | |
| | | // è·åå½åç»å½ç¨æ· |
| | | LoginUser user = getCurrentUser(); |
| | | if (user == null || StrUtil.isBlank(user.getId())) { |
| | | throw new JeecgBootException("è´¦å·ä¸åå¨"); |
| | | } |
| | | |
| | | //è·ååºåºç³è¯·åä¿¡æ¯ |
| | | OutboundOrder outboundOrder = getById(outBoundOrderFlowDto.getDataId()); |
| | | if (outboundOrder == null) { |
| | | throw new JeecgBootException("æªæ¾å°å¯¹åºçåºåºç³è¯·åï¼"); |
| | | } |
| | | |
| | | //è·åæµç¨ä¸å¡è®°å½ |
| | | FlowMyBusiness flowMyBusiness = getFlowMyBusiness(outBoundOrderFlowDto.getInstanceId()); |
| | | if (flowMyBusiness == null) { |
| | | throw new JeecgBootException("æµç¨è®°å½ä¸åå¨"); |
| | | } |
| | | |
| | | // æ£æ¥ç¨æ·æ¯å¦ææéæä½ä»»å¡ |
| | | if (!isUserAuthorized(flowMyBusiness, user)) { |
| | | throw new JeecgBootException("ç¨æ·æ ææä½æ¤ä»»å¡"); |
| | | } |
| | | |
| | | // 认é¢ä»»å¡ |
| | | if (!claimTask(flowMyBusiness.getTaskId(), user)) { |
| | | throw new JeecgBootException("ä»»å¡ä¸åå¨ã已宿æå·²è¢«ä»äººè®¤é¢"); |
| | | } |
| | | |
| | | //设置æµç¨åé |
| | | setupProcessVariables(outBoundOrderFlowDto, outboundOrder, user); |
| | | |
| | | //宿æµç¨ä»»å¡ |
| | | Result result = flowTaskService.complete(outBoundOrderFlowDto); |
| | | |
| | | //æ ¹æ®ä»»å¡å®æç»ææ´æ°ç³è¯·åç¶æ |
| | | if (result.isSuccess()) { |
| | | outboundOrder.setOrderStatus(outBoundOrderFlowDto.getStatus()); |
| | | if (OutBillStatus.APPROVED.getValue().equals(outBoundOrderFlowDto.getStatus())) { |
| | | outboundOrder.setOutStatus(OutBoundStatusEnum.NOT_OUTBOUND.getValue()); |
| | | } |
| | | outboundOrder.setAuditDate(new Date()); |
| | | outboundOrder.setApprovalOpinion(outBoundOrderFlowDto.getApprovalOpinion()); |
| | | updateById(outboundOrder); |
| | | } |
| | | } |
| | | |
| | | public boolean triggerProcess(OutboundOrder outboundOrder) { |
| | | flowCommonService.initActBusiness("åå·ä¸ºï¼" + outboundOrder.getOutNum() + " çåºåºç³è¯·ï¼å¼å§è¿è¡å®¡æ¹", |
| | | outboundOrder.getId(), "outboundOrderServiceImpl", "tool_out_storage", null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", outboundOrder.getId()); |
| | | if (StrUtil.isEmpty(outboundOrder.getRemark())) { |
| | | variables.put("organization", "æ°å¢åºåºç³è¯·åé»è®¤å¯å¨æµç¨"); |
| | | variables.put("comment", "æ°å¢åºåºç³è¯·åé»è®¤å¯å¨æµç¨"); |
| | | } else { |
| | | variables.put("organization", outboundOrder.getRemark()); |
| | | variables.put("comment", outboundOrder.getRemark()); |
| | | } |
| | | variables.put("proofreading", true); |
| | | List<String> usernames = new ArrayList<>(); |
| | | usernames.add(outboundOrder.getReviewer()); |
| | | variables.put("NextAssignee", usernames); |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("tool_out_storage", variables); |
| | | return result.isSuccess(); |
| | | } |
| | | |
| | | private LoginUser getCurrentUser() { |
| | | // è·åå½å认è¯çç»å½ç¨æ·ä¿¡æ¯ |
| | | Subject currentUser = SecurityUtils.getSubject(); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private FlowMyBusiness getFlowMyBusiness(String instanceId) { |
| | | List<FlowMyBusiness> businessList = flowMyBusinessService.list( |
| | | new LambdaQueryWrapper<FlowMyBusiness>().eq(FlowMyBusiness::getProcessInstanceId, instanceId)); |
| | | return businessList.isEmpty() ? null : businessList.get(0); |
| | | } |
| | | |
| | | private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { |
| | | List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); |
| | | return todoUsers != null && todoUsers.contains(user.getUsername()); |
| | | } |
| | | |
| | | private boolean claimTask(String taskId, LoginUser user) { |
| | | Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); |
| | | if (task == null) { |
| | | return false; |
| | | } |
| | | if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { |
| | | return false; |
| | | } |
| | | taskService.claim(taskId, user.getUsername()); |
| | | return true; |
| | | } |
| | | |
| | | private void setupProcessVariables(OutBoundOrderFlowDto outBoundOrderFlowDto, OutboundOrder outboundOrder, LoginUser user) { |
| | | if (OutBillStatus.SUBMITTED.getValue().equals(outboundOrder.getOrderStatus()) && user.getUsername().equals(outboundOrder.getReviewer())) { |
| | | Map<String, Object> values = new HashMap<>(); |
| | | values.put("dataId", outboundOrder.getId()); |
| | | values.put("organization", outBoundOrderFlowDto.getApprovalOpinion()); |
| | | values.put("comment", outBoundOrderFlowDto.getApprovalOpinion()); |
| | | values.put("status", outBoundOrderFlowDto.getStatus()); |
| | | values.put("NextAssignee", Collections.singletonList(outboundOrder.getReviewer())); |
| | | outBoundOrderFlowDto.setValues(values); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | | business.getTaskNameId();//æ¥ä¸æ¥å®¡æ¹çèç¹ |
| | | business.getValues();//åç«¯ä¼ è¿æ¥çåæ° |
| | | business.getActStatus(); |
| | | } |
| | | |
| | | @Override |
| | | public Object getBusinessDataById(String dataId) { |
| | | return this.getById(dataId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { |
| | | //ä¸å¡æ¯å¦å¹²é¢æµç¨ï¼ä¸å¡å¹²é¢ï¼æµç¨å¹²é¢ï¼æå®äººåè¿è¡å¤ç |
| | | //è·åä¸ä¸æ¥å¤ç人 |
| | | Object object = values.get("NextAssignee"); |
| | | return (List<String>) object; |
| | | } |
| | | } |