New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * è§è²:0-管çä¸è´£,1-ç»´æ¤ç»é¿,2-ç»´æ¤ç»å,10-é¢å¯¼,è¿ç»´å±-11,çæ§å±-12,ä¸åå±-14 |
| | | * */ |
| | | public enum RoleEnum { |
| | | ADMIN(0,"管çä¸è´£"), |
| | | GROUP_LEADER(1,"ç»´æ¤ç»é¿"), |
| | | GROUP_MEMBER(2,"ç»´æ¤ç»å"), |
| | | LEADER(10,"é¢å¯¼"), |
| | | MAINTAINER(11,"è¿ç»´å±"), |
| | | MONITOR(12,"çæ§å±"), |
| | | SPECIALIST(14,"ä¸åå±"); |
| | | |
| | | RoleEnum(Integer id, String name) { |
| | | this.id = id; |
| | | this.name = name; |
| | | } |
| | | |
| | | private Integer id; |
| | | private String name; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * 工使µç¸å
³æä¸¾ |
| | | */ |
| | | public enum WorkflowEnum { |
| | | /**主表(main)ç¶æ*/ |
| | | MAIN_STATUS_DEALING("审æ¹ä¸",1), |
| | | MAIN_STATUS_END_PASS("审æ¹ç»æ,éè¿",2), |
| | | MAIN_STATUS_END_REJECT("审æ¹ç»æ,驳å",3), |
| | | MAIN_STATUS_END_CANCEL("审æ¹ç»æ,æ¤é",4), |
| | | MAIN_STATUS_WAIT_FOR_DEALING("审æ¹ç»æ,å¾
å¤ç",5), |
| | | MAIN_STATUS_END_DEALT("审æ¹ç»æ,å·²å¤ç",6), |
| | | |
| | | /**å¤çç±»å deal_type*/ |
| | | TYPE_TAKE("æ¥å",0), |
| | | TYPE_TRANSFER_DISPATCH("转派",1), |
| | | TYPE_DELIVER("移交",2), |
| | | TYPE_ASSIGN("åæ´¾",3), |
| | | TYPE_REJECT("驳å",4), |
| | | TYPE_PASS("éè¿",5), |
| | | TYPE_REPLY("åå¤",6), |
| | | TYPE_FINISH("å¤ç并彿¡£",7), |
| | | |
| | | /**èç¹è¡¨(link)ç¶æ*/ |
| | | LINK_STATUS_PENDING("å¾
å¤ç",0), |
| | | LINK_STATUS_TAKING("å¾
æ¥å",1), |
| | | LINK_STATUS_DEALING("å¤çä¸", 2), |
| | | LINK_STATUS_WAIT_FOR_REPLY("å¾
åå¤", 3), |
| | | LINK_STATUS_DEAL_WITH_REPLY("å¤çåå¤", 4), |
| | | LINK_STATUS_PASS("éè¿", 5), |
| | | LINK_STATUS_WAIT_FOR_APPROVE("å¾
审æ¹", 6), |
| | | LINK_STATUS_CANCEL("å·²æ¤é", 7), |
| | | LINK_STATUS_REJECT("驳å", 8); |
| | | |
| | | private String name; |
| | | private Integer value; |
| | | |
| | | WorkflowEnum(String name, Integer value) { |
| | | this.name = name; |
| | | this.value = value; |
| | | } |
| | | |
| | | public final String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public final Integer getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(Integer value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * å®¡æ¹æµ-æµç¨èç¹æè¿° ->ç¨äºææçå®¡æ¹æµç¨ |
| | | */ |
| | | public enum WorkflowProcessEnum { |
| | | |
| | | PROCESS_SPECIALIST("P0","ä¸å审æ¹"), |
| | | PROCESS_COUNTERSIGN("P1","ä¼ç¾"), |
| | | PROCESS_MANAGER1SIGN("P2","管ç审æ¹"), |
| | | PROCESS_MANAGER2SIGN("P3","é¢å¯¼å®¡æ¹"), |
| | | ; |
| | | |
| | | WorkflowProcessEnum(String stage, String name) { |
| | | this.stage = stage; |
| | | this.name = name; |
| | | } |
| | | |
| | | private String stage; |
| | | private String name; |
| | | |
| | | public String getStage() { |
| | | return stage; |
| | | } |
| | | |
| | | public void setStage(String stage) { |
| | | this.stage = stage; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public static WorkflowProcessEnum getByName(String name) { |
| | | for (WorkflowProcessEnum workflowProcessEnum : WorkflowProcessEnum.values()) { |
| | | if (workflowProcessEnum.name.equals(name)) { |
| | | return workflowProcessEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.constant; |
| | | |
| | | /** |
| | | * TODO æ¯æ¬¡æ°å¢æµç¨æ¶,éè¦æç»ç»´æ¤ |
| | | */ |
| | | public enum WorkflowTypeEnum { |
| | | |
| | | DEVICE_DEFAULT(0,"æªå®ä¹çæµç¨ç³è¯·å","FG-WDY"), |
| | | DEVICE_REPAIR(1,"设å¤ç»´ä¿®ç³è¯·å","FG-WX"), |
| | | DEVICE_IN(2,"设å¤å
¥åºç³è¯·å","FG-RK"), |
| | | DEVICE_SCRAP(3,"è®¾å¤æ¥åºç³è¯·å","FG-BF"), |
| | | DEVICE_OUT(4,"设å¤åºåºç³è¯·å","FG-CK"); |
| | | |
| | | |
| | | private Integer type; |
| | | private String name; |
| | | |
| | | private String namingPrefix; |
| | | |
| | | WorkflowTypeEnum(Integer type, String name, String namingPrefix) { |
| | | this.type = type; |
| | | this.name = name; |
| | | this.namingPrefix = namingPrefix; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getNamingPrefix() { |
| | | return namingPrefix; |
| | | } |
| | | |
| | | public void setNamingPrefix(String namingPrefix) { |
| | | this.namingPrefix = namingPrefix; |
| | | } |
| | | |
| | | public static WorkflowTypeEnum getByType(Integer type) { |
| | | for (WorkflowTypeEnum value : WorkflowTypeEnum.values()) { |
| | | if (value.getType().equals(type)) { |
| | | return value; |
| | | } |
| | | } |
| | | return DEVICE_DEFAULT; |
| | | } |
| | | } |
| | |
| | | private BattalarmDataService battalarmDataService; |
| | | |
| | | @Autowired |
| | | private PwrdevAlarmService pwrdevAlarmService; |
| | | |
| | | @Autowired |
| | | private BattRealdataIdService battRealdataIdService; |
| | | |
| | | |
| | |
| | | @ApiOperation("è·åçµæ± åè¦åæ°") |
| | | public Response getBattAlmParam(@RequestBody ParamAlmDto dto){ |
| | | return battAlmparamService.getBattAlmParam(dto); |
| | | } |
| | | |
| | | @GetMapping("getBattAlmParamToExport") |
| | | @ApiOperation("è·åçµæ± åè¦åæ°(æ åç¨äºå¯¼åº)") |
| | | public Response getBattAlmParamToExport(){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | return battAlmparamService.getBattAlmParamToExport(uid); |
| | | } |
| | | |
| | | @PostMapping("setBattAlmParam") |
| | |
| | | return pwrAlmparamService.getPwrAlmParam(dto); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getPwrAlmParamToExport") |
| | | @ApiOperation("è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº)") |
| | | public Response getPwrAlmParamToExport(){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | return pwrAlmparamService.getPwrAlmParamToExport(uid); |
| | | } |
| | | @PostMapping("setPwrAlmParam") |
| | | @ApiOperation("ä¿®æ¹çµæºåè¦åæ°") |
| | | public Response setPwrAlmParam(@RequestBody List<PwrdevAlarmParam> almparamList){ |
| | |
| | | } |
| | | |
| | | @GetMapping("getBattHisRealInAlm") |
| | | @ApiOperation("çµæ± åè¦ç¹å»å
·ä½åè¦ä¿¡æ¯æ¥çä»åè¦å¼å§æ¶é´å°ç°å¨çåå²å®æ¶æ°æ®") |
| | | public Response getBattHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam String startTime,@RequestParam(required = false) Integer monNum) throws ParseException, InterruptedException { |
| | | return battRealdataIdService.getBattHisRealInAlm(battgroupId,startTime,monNum); |
| | | @ApiOperation("é¢è¦åæç®¡ç-䏻屿§ååæå±æ§") |
| | | public Response getBattHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam String startTime,@RequestParam(required = false) Integer almId) throws ParseException, InterruptedException { |
| | | return battRealdataIdService.getBattHisRealInAlm(battgroupId,startTime,almId); |
| | | } |
| | | |
| | | @PostMapping("getPwrtAlmAnalyse") |
| | | @ApiOperation("é¢è¦åæç®¡ç-çµæºåè¦") |
| | | public Response getPwrtAlmAnalyse(@RequestBody AlmAnalyseDto dto){ |
| | | Integer uid=ActionUtil.getUser().getId(); |
| | | dto.setUid(uid); |
| | | return pwrdevAlarmService.getPwrtAlmAnalyse(dto); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | @ApiOperation(value = "ä¼è¯çµæºæ°éç»è®¡(1.2.7)") |
| | | @PostMapping("getPwr7Statistic") |
| | | public Response getPwr7Statistic(@RequestBody Pwr7Stic stic){ |
| | | public Response getPwr7Statistic(@RequestBody Pwr7Stic stic) throws NoSuchFieldException, IllegalAccessException { |
| | | User uinf= ActionUtil.getUser(); |
| | | stic.setUid(uinf.getId()); |
| | | return battTinfService.getPwr7Statistic(stic); |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.service.WorkflowLinkService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("workflowLink") |
| | | @Api(tags = "忮审æ¹") |
| | | public class WorkflowLinkController extends BaseController{ |
| | | |
| | | @Autowired |
| | | private WorkflowLinkService service; |
| | | |
| | | @GetMapping("workflowInfo") |
| | | @ApiOperation(value = "å·¥åèç¹å表") |
| | | public Response<List<WorkflowLink>> getWorkflowInfo(@RequestParam Integer mainId){ |
| | | return new Response<List<WorkflowLink>>().set(1, service.getWorkflowInfo(mainId)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("link") |
| | | @ApiOperation(value = "æ´æ°èç¹", notes = "ä¼ ålink对象å
,ä¼ å
¥id,dealReasonæè
dealRejectReason;" + |
| | | "åæ®µstatus:5-éè¿,8-驳å") |
| | | public Response updateLink(@RequestBody WorkflowLink link) { |
| | | return service.updateLink(link); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.service.WorkflowLinkService; |
| | | import com.whyc.service.WorkflowMainService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @RequestMapping("workflowMain") |
| | | @Api(tags = "忮审æ¹") |
| | | public class WorkflowMainController { |
| | | |
| | | @Autowired |
| | | private WorkflowMainService service; |
| | | |
| | | @PostMapping("submit") |
| | | @ApiOperation(value = "æäº¤åæ®", notes = "ä¼ å:taskDesc,mainType,mainTypeCN,mainTypeEn,dealRoleId,processLevel") |
| | | public Response<Integer> submit(@RequestBody WorkflowMain main){ |
| | | return service.submit(main); |
| | | } |
| | | |
| | | |
| | | @GetMapping("basicInfo") |
| | | @ApiOperation(value = "å·¥ååºæ¬ç¶æ") |
| | | public Response<WorkflowMain> getBasicInfo(@RequestParam Integer mainId){ |
| | | return new Response<WorkflowMain>().set(1,service.getBaseInfo(mainId)); |
| | | } |
| | | |
| | | //æ¬äººçåæ®: 已审æ¹,审æ¹ä¸,å·²æ¤é,已驳å |
| | | //æ¥æ¶å°çåæ®: å¾
å®¡æ ¸,(å¾
æ¥åå®¡æ ¸?),å·²å®¡æ ¸ |
| | | |
| | | /** |
| | | * æ¬äººçåæ®: |
| | | * 已审æ¹,审æ¹ä¸,å·²æ¤é,已驳å |
| | | * */ |
| | | @GetMapping("ownStatistics") |
| | | @ApiOperation(value = "æ¬äººçåæ®ç»è®¡",notes = "statuså«ä¹:1-审æ¹ä¸,2-审æ¹å®æä¸éè¿,3-审æ¹å®æä¸é©³å") |
| | | public Response<Map<Integer,Integer>> getOwnStatistics(int type){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | return service.getOwnStatistics(userId,type); |
| | | } |
| | | |
| | | /** |
| | | * æ¬äººçåæ®: |
| | | * 已审æ¹,审æ¹ä¸,å·²æ¤é,已驳å |
| | | * */ |
| | | @GetMapping("ownListPage") |
| | | @ApiOperation(value = "æ¬äººçåæ®å表å页",notes = "statusä¼ å:0:å
¨é¨,1-审æ¹ä¸,2-审æ¹å®æä¸éè¿,3-审æ¹å®æä¸é©³å") |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int type,int status,int pageNum,int pageSize){ |
| | | int userId = ActionUtil.getUser().getId().intValue(); |
| | | return service.ownListPage(userId,type,status,pageNum,pageSize); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¶å°çåæ®: |
| | | * æ¾çµè®¡å临æ¶è¡¨ä¸åå¨: å¾
å®¡æ ¸,å¾
æ¥åå®¡æ ¸,å·²å®¡æ ¸ |
| | | * */ |
| | | @GetMapping("receivedStatistics") |
| | | @ApiOperation(value = "æ¥æ¶å°çåæ®ç»è®¡",notes = "statuså«ä¹:1-å¾
æ¥å,6-å¾
å®¡æ ¸,58-å·²å®¡æ ¸") |
| | | public Response<Map<Integer,Integer>> getReceivedStatistics(int type){ |
| | | User user = ActionUtil.getUser(); |
| | | return service.getReceivedStatistics(type,user); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¶å°çåæ®: |
| | | * æ¾çµè®¡å临æ¶è¡¨ä¸åå¨: å¾
å®¡æ ¸,å¾
æ¥åå®¡æ ¸,å·²å®¡æ ¸ |
| | | */ |
| | | @GetMapping("receivedListPage") |
| | | @ApiOperation(value = "æ¥æ¶å°çåæ®å表å页", notes = "statusä¼ å:0-å
¨é¨,1-å¾
æ¥å,6-å¾
å®¡æ ¸,5|8-å·²å®¡æ ¸(éè¿|驳å)") |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, int pageNum, int pageSize) { |
| | | User user = ActionUtil.getUser(); |
| | | return service.getReceivedListPage(type, status, user, pageNum, pageSize); |
| | | } |
| | | |
| | | } |
| | |
| | | private Date inuseTime; |
| | | private String stationType; |
| | | private String groupName; |
| | | private String performanceName;//çµæ± æ§è½ï¼1ä¼ç§ï¼2å£åï¼3æå 4æªæ¾çµ ä¸ä¼ å
¨é¨ |
| | | private String performanceName;//çµæ± æ§è½ï¼1ä¼ç§ï¼2ä¸è¬ï¼3é¢è¦ 4严éä¸ä¼ å
¨é¨ |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_param.AlmAnalysisParam; |
| | | |
| | | public interface AlmAnalysisParamMapper extends CustomMapper<AlmAnalysisParam>{ |
| | | } |
| | |
| | | public interface BattAlmparamMapper extends CustomMapper<BattAlmparam>{ |
| | | //è·åçµæ± åè¦åæ° |
| | | List<BattAlmparam> getBattAlmParam(@Param("almDto") AlmDto almDto); |
| | | //è·åçµæ± åè¦åæ°(æ åç¨äºå¯¼åº) |
| | | List<BattAlmparam> getBattAlmParamToExport(@Param("uid") Integer uid); |
| | | } |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.dto.AlarmDto; |
| | | import com.whyc.dto.Param.AlmAnalyseDto; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | |
| | | import java.util.List; |
| | |
| | | List<AlarmInspection> getListGreatThan(Long id); |
| | | |
| | | List<AlarmDto> getListByUserId(Integer userId, Integer alarmLevel); |
| | | |
| | | //é¢è¦åæç®¡ç-çµæºåè¦ |
| | | List<PwrdevAlarm> getPwrtAlmAnalyse(AlmAnalyseDto dto); |
| | | } |
| | |
| | | public interface PwrdevAlarmParamMapper extends CustomMapper<PwrdevAlarmParam>{ |
| | | //è·åçµæºåè¦åæ° |
| | | List<PwrdevAlarmParam> getPwrAlmParam(@Param("almDto") AlmDto almDto); |
| | | //è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº) |
| | | List<PwrdevAlarmParam> getPwrAlmParamToExport(@Param("uid") Integer uid); |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.web_site.WorkflowDevice; |
| | | |
| | | public interface WorkflowDeviceMapper extends CustomMapper<WorkflowDevice>{ |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface WorkflowLinkMapper extends CustomMapper<WorkflowLink> { |
| | | |
| | | List<WorkflowLink> getReceivedList(int type, User user); |
| | | |
| | | /**äºæ¬¡æ ¸å®¹å鿣æ
éçç»è®¡*/ |
| | | List<WorkflowLink> getReceivedList2(int type, User user); |
| | | |
| | | //æ¥è¯¢èªå·±éè¦å¤çæè
审æ¹ç |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.mapper; |
| | | |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface WorkflowMainMapper extends CustomMapper<WorkflowMain> { |
| | | |
| | | List<WorkflowMain> getReceivedListByUserAndType(User user, int type, int status); |
| | | |
| | | //æ¥è¯¢è¡¨åç¼å· |
| | | Integer getMaxId(); |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.db_param; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | 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 java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * é¢è¦åæç®¡çå
³èåæ®µé
置表 |
| | | * </p> |
| | | * |
| | | * @author lxw |
| | | * @since 2025-06-19 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName(schema = "db_param",value ="tb_alm_analysis_param") |
| | | @ApiModel(value="AlmAnalysisParam对象", description="é¢è¦åæç®¡çå
³èåæ®µé
置表") |
| | | public class AlmAnalysisParam implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "èªå¢ä¸»é®") |
| | | @TableId(value = "num", type = IdType.AUTO) |
| | | private Long num; |
| | | |
| | | @ApiModelProperty(value = "åè¦ID") |
| | | private Integer almId; |
| | | |
| | | @ApiModelProperty(value = "主åèåæ®µ") |
| | | private String mainField; |
| | | |
| | | @ApiModelProperty(value = "䏻忮µç±»å[1:ç´æµï¼2ï¼éä¿¡ï¼3é
ç½ 4:çµæ± 5:设å¤]") |
| | | private Integer mainFieldType; |
| | | |
| | | @ApiModelProperty(value = "次è¦å段1åèé
ç½®") |
| | | private String minorField1; |
| | | |
| | | @ApiModelProperty(value = "åæ®µ1ç±»å[1:ç´æµï¼2ï¼éä¿¡ï¼3é
ç½ 4:çµæ± 5:设å¤]") |
| | | private Integer minorField1Type; |
| | | |
| | | @ApiModelProperty(value = "次è¦å段2åèé
ç½®") |
| | | private String minorField2; |
| | | |
| | | @ApiModelProperty(value = "åæ®µ2ç±»å[1:ç´æµï¼2ï¼éä¿¡ï¼3é
ç½ 4:çµæ± 5:设å¤]") |
| | | private Integer minorField2Type; |
| | | |
| | | @ApiModelProperty(value = "次è¦å段3åèé
ç½®") |
| | | private String minorField3; |
| | | |
| | | @ApiModelProperty(value = "åæ®µ3ç±»å[1:ç´æµï¼2ï¼éä¿¡ï¼3é
ç½ 4:çµæ± 5:设å¤]") |
| | | private Integer minorField3Type; |
| | | |
| | | @ApiModelProperty(value = "次è¦å段4åèé
ç½®") |
| | | private String minorField4; |
| | | |
| | | @ApiModelProperty(value = "åæ®µ4ç±»å[1:ç´æµï¼2ï¼éä¿¡ï¼3é
ç½ 4:çµæ± 5:设å¤]") |
| | | private Integer minorField4Type; |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "ä¸ä¸éåè¦ä½¿è½") |
| | | private Integer almLowCoeLowerEn; |
| | | |
| | | @ApiModelProperty(value = "åè¦å»¶è¿æ¶é¿[åä½ï¼ç§]") |
| | | private Integer almDelayTime; |
| | | |
| | | @TableField(exist = false) |
| | | private String provice; |
| | | |
| | |
| | | @TableField(exist = false) |
| | | private String battgroupName; |
| | | |
| | | @TableField(exist = false) |
| | | private String devName; |
| | | |
| | | } |
| | |
| | | private Float alarmLimithUpper; |
| | | |
| | | @TableField(exist = false) |
| | | private Float alarmLimithLowper; |
| | | private Float alarmLimitlLower; |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | @ToString |
| | | @Data |
| | | @TableName(schema = "web_site",value ="tb_workflow_device") |
| | | @ApiModel("工忍¡å-ç°åºæ
鿍¡å-ç»´ä¿®-å
¥åº-æ¥åº-åºåºç设å¤ä¿¡æ¯") |
| | | public class WorkflowDevice { |
| | | |
| | | private Integer id; |
| | | @ApiModelProperty("å¨ä»¶åç§°") |
| | | private String name; |
| | | @ApiModelProperty("å¨ä»¶åå·") |
| | | private String model; |
| | | @ApiModelProperty("å¨ä»¶çæ¬") |
| | | private String version; |
| | | @ApiModelProperty("æ°é") |
| | | private Integer quantity; |
| | | @ApiModelProperty("æªå¤ççæ°é.ç»´ä¿®ç³è¯·æ¶éå¡«å
¥") |
| | | private Integer quantityUnprocessed; |
| | | @ApiModelProperty("åç") |
| | | private String brand; |
| | | @ApiModelProperty("ç±»å") |
| | | private String type; |
| | | @ApiModelProperty("ä¾åºå") |
| | | private String supplier; |
| | | @ApiModelProperty("工念ç¨ä¸»è¡¨id") |
| | | private Integer mainId; |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.ToString; |
| | | import org.apache.ibatis.type.Alias; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 工使µèç¹è¡¨ |
| | | */ |
| | | @ToString |
| | | @Alias("WorkflowLink") |
| | | @TableName(schema = "web_site",value = "tb_workflow_link") |
| | | @JsonIgnoreProperties(ignoreUnknown = true) |
| | | public class WorkflowLink { |
| | | |
| | | private Integer id; |
| | | @ApiModelProperty("主表id") |
| | | private Integer mainId; |
| | | @ApiModelProperty("ä¸çº§id") |
| | | private Integer parentId; |
| | | @ApiModelProperty("å¤çå±çº§") |
| | | private String processStage; |
| | | @ApiModelProperty("å¤çå±çº§åç§°") |
| | | private String processName; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | @ApiModelProperty("å¤ç人id") |
| | | private Integer dealUserId; |
| | | @ApiModelProperty("å¤çç±»å") |
| | | private Integer dealType; |
| | | @ApiModelProperty("å¤çæè¿°") |
| | | private String dealDesc; |
| | | @ApiModelProperty("å¤çéä»¶åç§°") |
| | | private String dealFileName; |
| | | @ApiModelProperty("å¤çéä»¶å°å") |
| | | private String dealFileUrl; |
| | | @ApiModelProperty("å¤çå¾çåç§°") |
| | | private String dealPicName; |
| | | @ApiModelProperty("å¤çå¾çå°å") |
| | | private String dealPicUrl; |
| | | @ApiModelProperty("èç¹ç¶æ") |
| | | private Integer status; |
| | | @ApiModelProperty("å¤çè§è²") |
| | | private Integer dealRoleId; |
| | | @ApiModelProperty("å¤çå®è½å¦å½æ¡£") |
| | | private Integer dealAndClose; |
| | | @ApiModelProperty("驳ååå ") |
| | | private String dealRejectReason; |
| | | @ApiModelProperty("å任塿°") |
| | | private Integer dealTaskNum; |
| | | @ApiModelProperty("åä»»å¡å夿°") |
| | | private Integer dealTaskReplyNum; |
| | | @ApiModelProperty("å¤ç建议") |
| | | private String dealReason; |
| | | @ApiModelProperty("å¤çæ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date dealTime; |
| | | @ApiModelProperty("è¦æ±å®ææ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date requiredFinishTime; |
| | | @ApiModelProperty("审æ¹åå¤å
容") |
| | | private String replyContent; |
| | | @ApiModelProperty("审æ¹å夿¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date replyTime; |
| | | |
| | | @TableField(exist = false) |
| | | private List<Integer> dealUserIdList; |
| | | |
| | | @TableField(exist = false) |
| | | private WorkflowMain workflowMain; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getMainId() { |
| | | return mainId; |
| | | } |
| | | |
| | | public void setMainId(Integer mainId) { |
| | | this.mainId = mainId; |
| | | } |
| | | |
| | | public Integer getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Integer parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getProcessStage() { |
| | | return processStage; |
| | | } |
| | | |
| | | public void setProcessStage(String processStage) { |
| | | this.processStage = processStage; |
| | | } |
| | | |
| | | public String getProcessName() { |
| | | return processName; |
| | | } |
| | | |
| | | public void setProcessName(String processName) { |
| | | this.processName = processName; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Integer getDealUserId() { |
| | | return dealUserId; |
| | | } |
| | | |
| | | public void setDealUserId(Integer dealUserId) { |
| | | this.dealUserId = dealUserId; |
| | | } |
| | | |
| | | public Integer getDealType() { |
| | | return dealType; |
| | | } |
| | | |
| | | public void setDealType(Integer dealType) { |
| | | this.dealType = dealType; |
| | | } |
| | | |
| | | public String getDealDesc() { |
| | | return dealDesc; |
| | | } |
| | | |
| | | public void setDealDesc(String dealDesc) { |
| | | this.dealDesc = dealDesc; |
| | | } |
| | | |
| | | public String getDealFileName() { |
| | | return dealFileName; |
| | | } |
| | | |
| | | public void setDealFileName(String dealFileName) { |
| | | this.dealFileName = dealFileName; |
| | | } |
| | | |
| | | public String getDealFileUrl() { |
| | | return dealFileUrl; |
| | | } |
| | | |
| | | public void setDealFileUrl(String dealFileUrl) { |
| | | this.dealFileUrl = dealFileUrl; |
| | | } |
| | | |
| | | public String getDealPicName() { |
| | | return dealPicName; |
| | | } |
| | | |
| | | public void setDealPicName(String dealPicName) { |
| | | this.dealPicName = dealPicName; |
| | | } |
| | | |
| | | public String getDealPicUrl() { |
| | | return dealPicUrl; |
| | | } |
| | | |
| | | public void setDealPicUrl(String dealPicUrl) { |
| | | this.dealPicUrl = dealPicUrl; |
| | | } |
| | | |
| | | public Integer getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(Integer status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public Integer getDealRoleId() { |
| | | return dealRoleId; |
| | | } |
| | | |
| | | public void setDealRoleId(Integer dealRoleId) { |
| | | this.dealRoleId = dealRoleId; |
| | | } |
| | | |
| | | public Integer getDealAndClose() { |
| | | return dealAndClose; |
| | | } |
| | | |
| | | public void setDealAndClose(Integer dealAndClose) { |
| | | this.dealAndClose = dealAndClose; |
| | | } |
| | | |
| | | public String getDealRejectReason() { |
| | | return dealRejectReason; |
| | | } |
| | | |
| | | public void setDealRejectReason(String dealRejectReason) { |
| | | this.dealRejectReason = dealRejectReason; |
| | | } |
| | | |
| | | public Integer getDealTaskNum() { |
| | | return dealTaskNum; |
| | | } |
| | | |
| | | public void setDealTaskNum(Integer dealTaskNum) { |
| | | this.dealTaskNum = dealTaskNum; |
| | | } |
| | | |
| | | public Integer getDealTaskReplyNum() { |
| | | return dealTaskReplyNum; |
| | | } |
| | | |
| | | public void setDealTaskReplyNum(Integer dealTaskReplyNum) { |
| | | this.dealTaskReplyNum = dealTaskReplyNum; |
| | | } |
| | | |
| | | public String getDealReason() { |
| | | return dealReason; |
| | | } |
| | | |
| | | public void setDealReason(String dealReason) { |
| | | this.dealReason = dealReason; |
| | | } |
| | | |
| | | public Date getDealTime() { |
| | | return dealTime; |
| | | } |
| | | |
| | | public void setDealTime(Date dealTime) { |
| | | this.dealTime = dealTime; |
| | | } |
| | | |
| | | public List<Integer> getDealUserIdList() { |
| | | return dealUserIdList; |
| | | } |
| | | |
| | | public void setDealUserIdList(List<Integer> dealUserIdList) { |
| | | this.dealUserIdList = dealUserIdList; |
| | | } |
| | | |
| | | public Date getRequiredFinishTime() { |
| | | return requiredFinishTime; |
| | | } |
| | | |
| | | public void setRequiredFinishTime(Date requiredFinishTime) { |
| | | this.requiredFinishTime = requiredFinishTime; |
| | | } |
| | | |
| | | public String getReplyContent() { |
| | | return replyContent; |
| | | } |
| | | |
| | | public void setReplyContent(String replyContent) { |
| | | this.replyContent = replyContent; |
| | | } |
| | | |
| | | public Date getReplyTime() { |
| | | return replyTime; |
| | | } |
| | | |
| | | public void setReplyTime(Date replyTime) { |
| | | this.replyTime = replyTime; |
| | | } |
| | | |
| | | public WorkflowMain getWorkflowMain() { |
| | | return workflowMain; |
| | | } |
| | | |
| | | public void setWorkflowMain(WorkflowMain workflowMain) { |
| | | this.workflowMain = workflowMain; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.pojo.web_site; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | import org.apache.ibatis.type.Alias; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 工使µä¸»è¡¨ |
| | | */ |
| | | @ToString |
| | | @Data |
| | | @Alias("WorkflowMain") |
| | | @TableName(schema = "web_site",value = "tb_workflow_main") |
| | | public class WorkflowMain { |
| | | |
| | | private Integer id; |
| | | /** |
| | | * å·¥åid,è§è:WF-1-20211101-00001 |
| | | * (Workflow)-(å·¥åç±»å åè¦:1 æ®é:2)-(å¹´ææ¥)-(彿¥ç¼å·åºå) |
| | | * |
| | | * */ |
| | | @ApiModelProperty("å·¥åid,è§è:FG-GF-1-20211101-00001,(Workflow)-(å·¥åç±»å åè¦:1 æ®é:2)-(å¹´ææ¥)-(彿¥ç¼å·åºå)") |
| | | private String orderId; |
| | | /**æ é¢*/ |
| | | @ApiModelProperty("æ é¢") |
| | | private String title; |
| | | /**ä»»å¡æè¿°*/ |
| | | @ApiModelProperty("ä»»å¡æè¿°") |
| | | private String taskDesc; |
| | | /**å建人id*/ |
| | | @ApiModelProperty("å建人id") |
| | | private Integer createUserId; |
| | | /**å建æ¶é´*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | | /**ä»»å¡è®¡åå¼å§æ¶é´*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date planBeginTime; |
| | | /**ä»»å¡è®¡åç»ææ¶é´*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date planEndTime; |
| | | /**ä»»å¡å¼å§å¤çæ¶é´*/ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date beginTime; |
| | | /**ä»»å¡å½æ¡£æ¶é´*/ |
| | | @ApiModelProperty("彿¡£æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai") |
| | | private Date endTime; |
| | | /**ä»»å¡ç级*/ |
| | | @ApiModelProperty("ä»»å¡ç级") |
| | | private Integer taskLevel; |
| | | /**æ¯å¦åæ¶*/ |
| | | @ApiModelProperty("æ¯å¦åæ¶") |
| | | @TableField("is_in_time") |
| | | private Integer inTime; |
| | | @ApiModelProperty("æµç¨è¿ç¨é¶æ®µ") |
| | | private String processStage; |
| | | @ApiModelProperty("å·¥åç¶æ") |
| | | private Integer status; |
| | | /**éä»¶åç§°*/ |
| | | @ApiModelProperty("éä»¶åç§°") |
| | | private String fileName; |
| | | /**éä»¶å°å*/ |
| | | @ApiModelProperty("éä»¶å°å") |
| | | private String fileUrl; |
| | | /**å¾çåç§°*/ |
| | | @ApiModelProperty("å¾çåç§°") |
| | | private String picName; |
| | | /**å¾çå°å*/ |
| | | @ApiModelProperty("å¾çå°å") |
| | | private String picUrl; |
| | | /**彿¡£æè§*/ |
| | | @ApiModelProperty("彿¡£æè§") |
| | | private String endReason; |
| | | /**æ¯å¦èªå¨æ´¾å*/ |
| | | @ApiModelProperty("æ¯å¦èªå¨æ´¾å") |
| | | @TableField("is_auto") |
| | | private Integer auto; |
| | | |
| | | @ApiModelProperty("å
³èå·¥åid") |
| | | private Integer relatedId; |
| | | |
| | | /** |
| | | * @see com.whyc.constant.WorkflowTypeEnum |
| | | */ |
| | | @ApiModelProperty("å·¥åæµç±»å") |
| | | private Integer type; |
| | | |
| | | @TableField(exist = false) |
| | | private String createUserName; |
| | | |
| | | @TableField(exist = false) |
| | | private List<WorkflowLink> linkList; |
| | | |
| | | @TableField(exist = false) |
| | | private List<WorkflowDevice> deviceList; |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.mapper.AlmAnalysisParamMapper; |
| | | import com.whyc.pojo.db_param.AlmAnalysisParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class AlmAnalysisParamService { |
| | | @Autowired(required = false) |
| | | private AlmAnalysisParamMapper mapper; |
| | | //è·ååè¦almId对åºçåæé
ç½®å±æ§å¼ |
| | | public AlmAnalysisParam getAnalysisParam(Integer almId) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("alm_id",almId); |
| | | wrapper.last("limit 1"); |
| | | AlmAnalysisParam param= mapper.selectOne(wrapper); |
| | | return param; |
| | | } |
| | | } |
| | |
| | | wrapper.orderByAsc("id"); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | //è·åé¢è¦åæå¨æéå¼ |
| | | public AppParam getAlarmAnalysisCycle() { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | wrapper.eq("param_name_psx","alm_analysis_already_time"); |
| | | wrapper.last("limit 1"); |
| | | AppParam param=mapper.selectOne(wrapper); |
| | | return param; |
| | | } |
| | | } |
| | |
| | | //æ¥è¯¢æºæ¿æå¨ççç» |
| | | public String getGroupName(Integer powerId) { |
| | | String groupName = powerInfMapper.getGroupName(powerId); |
| | | if(groupName==null||groupName.length()<0){ |
| | | groupName="none"; |
| | | } |
| | | return groupName; |
| | | } |
| | | //æ¥è¯¢ææçå
æºç»åéåï¼çç»ï¼ |
| | |
| | | //PageInfo<BattAlmparam> pageInfo=new PageInfo<>(list); |
| | | return new Response().setIII(1,list!=null,list,binf,"è·åçµæ± åè¦åæ°"); |
| | | } |
| | | //è·åçµæ± åè¦åæ°(æ åç¨äºå¯¼åº) |
| | | public Response getBattAlmParamToExport(Integer uid) { |
| | | //è·åææççµæ± ç»id |
| | | List<BattAlmparam> list = mapper.getBattAlmParamToExport(uid); |
| | | return new Response().setII(1,list!=null,list,"è·åçµæ± åè¦åæ°"); |
| | | } |
| | | //ä¿®æ¹çµæ± åè¦åæ° |
| | | public Response setBattAlmParam(List<BattAlmparam> almparamList) { |
| | | for (BattAlmparam param:almparamList) { |
| | |
| | | import com.whyc.mapper.CommonMapper; |
| | | |
| | | import com.whyc.pojo.db_data_history.BattRealdataId; |
| | | import com.whyc.pojo.db_param.AlmAnalysisParam; |
| | | import com.whyc.pojo.db_param.AppParam; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | |
| | | |
| | | @Autowired |
| | | private BattInfService binfService; |
| | | |
| | | @Autowired |
| | | private AlmAnalysisParamService almAnalysisParamService; |
| | | |
| | | @Autowired |
| | | private AppParamService appParamService; |
| | | |
| | | |
| | | //è·åçµæ± ç»æè¿ä¸å£åº¦çå使°æ® |
| | |
| | | return new Response().set(1, dataListSorted); |
| | | } |
| | | //çµæ± åè¦ç¹å»å
·ä½åè¦ä¿¡æ¯æ¥çä»åè¦å¼å§æ¶é´å°ç°å¨çåå²å®æ¶æ°æ® |
| | | public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer monNum) throws ParseException, InterruptedException { |
| | | public Response getBattHisRealInAlm(Integer battgroupId, String startTime, Integer almId) throws ParseException, InterruptedException { |
| | | //è·ååè¦almId对åºçåæé
ç½®å±æ§å¼ |
| | | AlmAnalysisParam almAnalysisParam= almAnalysisParamService.getAnalysisParam(almId); |
| | | List<RealDateDTO> dataList = new LinkedList<>(); |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(ThreadLocalUtil.parse(startTime,1),new Date()); |
| | | //è·åé¢è¦åæå¨æéå¼ |
| | | AppParam appParam = appParamService.getAlarmAnalysisCycle(); |
| | | Integer cycleTime=appParam.getParamValue().intValue(); |
| | | Date cyscleDate=ActionUtil.getDateAdd(ThreadLocalUtil.parse(startTime,1),cycleTime*(-1)); |
| | | //è·åcyscleDateå°ç°å¨ææçåå²å®æ¶æ°æ® |
| | | List<List<Date>> monthTimeList = DateUtil.getMonthTime(cyscleDate,new Date()); |
| | | ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor(); |
| | | CountDownLatch latch = new CountDownLatch(monthTimeList.size()); |
| | | for (int i = 0; i < monthTimeList.size(); i++) { |
| | |
| | | int tableNum = subTablePageInfoService.judgeTable_realdata(table); |
| | | List<RealDateDTO> list = new ArrayList(); |
| | | if (tableNum > 0) { |
| | | //è·åæå®æ¶é´æ®µå
æå¤§æå°recordNumç¡®ä¿æ°æ®ç宿´ |
| | | List recordNums= subTablePageInfoService.getMaxAndMinRecordNum(realdata); |
| | | Integer maxRecordNum= 0; |
| | | Integer minRecordNum= 0; |
| | | if(recordNums.size()>0){ |
| | | maxRecordNum=(Integer)recordNums.get(0); |
| | | minRecordNum=(Integer)recordNums.get(1); |
| | | } |
| | | list = subTablePageInfoService.getBattRealDataHis(realdata,1,maxRecordNum,minRecordNum); |
| | | list = subTablePageInfoService.getBattHisRealInAlm(realdata); |
| | | } |
| | | dataList.addAll(list); |
| | | latch.countDown(); |
| | |
| | | } |
| | | latch.await(10, TimeUnit.MINUTES); |
| | | List dataListSorted = dataList.stream().sorted(Comparator.comparing(RealDateDTO::getRecordTime)).collect(Collectors.toList()); |
| | | return new Response().set(1, dataListSorted); |
| | | return new Response().setIII(1,true, dataListSorted,almAnalysisParam,"çµæ± åè¦ç¹å»å
·ä½åè¦ä¿¡æ¯æ¥çä»åè¦å¼å§æ¶é´å°ç°å¨çåå²å®æ¶æ°æ®"); |
| | | |
| | | } |
| | | } |
| | |
| | | return new Response().setII(1,reslist.size()>0,pageInfo,"çµæ± ç»çµæ± æ§è½ç»è®¡ï¼æªæ¾çµï¼ä¼ç§ï¼å£åï¼æåï¼ç»è®¡(1.2.8/9/10)"); |
| | | } |
| | | //ä¼è¯çµæºæ°éç»è®¡(1.2.7) |
| | | public Response getPwr7Statistic(Pwr7Stic stic) { |
| | | public Response getPwr7Statistic(Pwr7Stic stic) throws NoSuchFieldException, IllegalAccessException { |
| | | Date inuseTimeStart =new Date(); |
| | | if(stic.getInuseYear()==1){ |
| | | //æå
¥ä½¿ç¨æ¶é´æ¡ä»¶çé |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(5); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | }else{ |
| | | //æå
¥ä½¿ç¨æ¶é´æ¡ä»¶çé |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(stic.getInuseYear()); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | if(stic.getInuseYear()!=null){ |
| | | if(stic.getInuseYear()==1){ |
| | | //æå
¥ä½¿ç¨æ¶é´æ¡ä»¶çé |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(5); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | }else{ |
| | | //æå
¥ä½¿ç¨æ¶é´æ¡ä»¶çé |
| | | LocalDateTime startTime = LocalDateTime.now().minusYears(stic.getInuseYear()); |
| | | inuseTimeStart = DateUtil.convertToDate(startTime); |
| | | } |
| | | stic.setPwrInUseTime(inuseTimeStart); |
| | | } |
| | | stic.setPwrInUseTime(inuseTimeStart); |
| | | //1æ¥è¯¢ç¬¦åæ¡ä»¶ççµæ± ç» |
| | | List<PowerInf> pinfList=powerInfService.getPwr7Statistic(stic); |
| | | if(pinfList==null||pinfList.size()==0){ |
| | |
| | | res.setInuseTime(pinf.getPowerInuseTime()); |
| | | Integer performance= pwrHisdataIdService.getPwrQuarter7(pinf.getPowerId(),pinf.getPowerType()); |
| | | res.setPerformanceName(PwrCapperformanceEnum.getValue(performance)); |
| | | reslist.add(res); |
| | | if(stic.getPerformance()==null){ |
| | | reslist.add(res); |
| | | }else{ |
| | | if(performance==stic.getPerformance()){ |
| | | reslist.add(res); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | PageInfo pageInfo=PageInfoUtils.list2PageInfo(reslist, stic.getPageNum(), stic.getPageSize()); |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.BattSingalIdEnum; |
| | | import com.whyc.constant.PowerAlarmEnum; |
| | | import com.whyc.dto.AlarmParam; |
| | | import com.whyc.dto.Param.AlmAnalyseDto; |
| | | import com.whyc.dto.Param.ParamAlmDto; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PwrdevAlarmParamMapper; |
| | | import com.whyc.pojo.db_alarm.BattalarmData; |
| | | import com.whyc.pojo.db_param.BattAlmparam; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | | import com.whyc.pojo.db_station.PowerInf; |
| | |
| | | // PageInfo<PwrdevAlarmParam> pageInfo=new PageInfo(list); |
| | | return new Response().setIII(1,list!=null,list,pinf,"è·åçµæºåè¦åæ°"); |
| | | } |
| | | |
| | | //è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº) |
| | | public Response getPwrAlmParamToExport(Integer uid) { |
| | | List<PwrdevAlarmParam> list = mapper.getPwrAlmParamToExport(uid); |
| | | return new Response().setII(1,list!=null,list,"è·åçµæºåè¦åæ°(æ åç¨äºå¯¼åº)"); |
| | | } |
| | | //ä¿®æ¹çµæºåè¦åæ° |
| | | public Response setPwrAlmParam(List<PwrdevAlarmParam> almparamList) { |
| | | for (PwrdevAlarmParam param:almparamList) { |
| | |
| | | import com.whyc.constant.DevAlarmEnum; |
| | | import com.whyc.constant.PowerAlarmEnum; |
| | | import com.whyc.dto.AlarmDto; |
| | | import com.whyc.dto.Param.AlmAnalyseDto; |
| | | import com.whyc.dto.Real.AlmDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.PwrdevAlarmMapper; |
| | | import com.whyc.pojo.db_alarm.DevalarmData; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm; |
| | | import com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam; |
| | | import com.whyc.pojo.web_site.AlarmInspection; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public List<AlarmDto> getListByUserId(Integer userId,Integer alarmLevel) { |
| | | return mapper.getListByUserId(userId,alarmLevel); |
| | | } |
| | | |
| | | //é¢è¦åæç®¡ç-çµæºåè¦ |
| | | public Response getPwrtAlmAnalyse(AlmAnalyseDto dto) { |
| | | PageHelper .startPage(dto.getPageNum(),dto.getPageSize()); |
| | | List<PwrdevAlarm> list=mapper.getPwrtAlmAnalyse(dto); |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"çµæºåè¦åæ"); |
| | | } |
| | | } |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.constant.PwrCapperformanceEnum; |
| | | import com.whyc.dto.Real.CompareDto; |
| | | import com.whyc.dto.Real.PwrHisRealAcInDto; |
| | | import com.whyc.dto.Real.PwrHisRealDcoutInDto; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Field; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | |
| | | return new Response().setIII(1,datalist.size()>0,datalist,modelCfg,"è·ååå°æ¶å
ç´æµè¾åºç»è®¡"); |
| | | } |
| | | //1.2.7ä¼è¯çµæºç»è®¡ä¸ä¸å£åº¦ççµæºæä¸å±æ§ååæ°éå¼è¶
è¿çæ¬¡æ° |
| | | public Integer getPwrQuarter7(Integer powerId,Integer powerType) { |
| | | public Integer getPwrQuarter7(Integer powerId,Integer powerType) throws NoSuchFieldException, IllegalAccessException { |
| | | Map<String,Integer> map=new HashMap<>(); |
| | | //è·åä¼è¯çµæºæ§è½ç»è®¡å¨å¹³å°ä¸çæ¶é´åæ°è®¾ç½®è¡¨ |
| | | ApptimeParam apptimeParam=apptimeParamService.getPwrPerformanceStrartTime(powerId); |
| | |
| | | List<String> datelist=ActionUtil.getDateListBetweenDates(apptimeParam.getParamValue(), new Date()); |
| | | //è·åçµæºä¼è¯å¤æçæ ååæ°å¼ |
| | | List<PowerPropertyParam> paramList=propertyParamService.getPwrStandardParam(powerType); |
| | | Map<String,Float> paramValues=new HashMap<>(); |
| | | /*Map<String,Float> paramValues=new HashMap<>(); |
| | | for (PowerPropertyParam param : paramList) { |
| | | paramValues.put(param.getPropertyName()+"_upper", param.getBasisVal()*param.getAlarmLimithUpper()); |
| | | paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimithLowper()); |
| | | paramValues.put(param.getPropertyName()+"_lower", param.getBasisVal()*param.getAlarmLimitlLower()); |
| | | map.put(param.getPropertyName(), 0); |
| | | } |
| | | }*/ |
| | | for (int i=0;i<datelist.size();i++) { |
| | | String date=datelist.get(i); |
| | | String tableName ="db_data_history.tb_pwrdev_historydata_"+powerId+"_"+date; |
| | |
| | | if(existTableName == null){ |
| | | continue; |
| | | } |
| | | List<QuarterPwr7Res> datalist=subTablePageInfoService.getPwrQuarter7(tableName); |
| | | List<PwrdevHistorydataId> datalist=subTablePageInfoService.getPwrQuarter7(tableName); |
| | | // éå dataList å¹¶æ¯è¾å±æ§å¼ |
| | | for (QuarterPwr7Res data : datalist) { |
| | | if(paramValues.get("acin1_vola_upper")!=null){ |
| | | for (PwrdevHistorydataId data : datalist) { |
| | | /*if(paramValues.get("acin1_vola_upper")!=null){ |
| | | if ((data.getAcin1Vola() > paramValues.get("acin1_vola_upper"))||(data.getAcin1Vola() < paramValues.get("acin1_vola_lower"))) { |
| | | map.put("acin1_vola", map.get("acin1_vola") + 1); |
| | | } |
| | |
| | | if ((data.getDcoutCurr() > paramValues.get("dcout_curr_upper")) || (data.getDcoutCurr() < paramValues.get("dcout_curr_lower"))) { |
| | | map.put("dcout_curr", map.get("dcout_curr") + 1); |
| | | } |
| | | }*/ |
| | | for (int j=0;j<paramList.size();j++) { |
| | | PowerPropertyParam param = paramList.get(j); |
| | | String propertyName = ActionUtil.toCamelCase(param.getPropertyName()); |
| | | Field field = PwrdevHistorydataId.class.getDeclaredField(propertyName); |
| | | field.setAccessible(true); // 妿忮µæ¯ç§æçï¼éè¦è®¾ç½®ä¸ºå¯è®¿é® |
| | | Float value = (Float) field.get(data); |
| | | if ((value > (param.getBasisVal()*param.getAlarmLimithUpper()))||(value <(param.getBasisVal()*param.getAlarmLimitlLower()))) { |
| | | int limitNum=map.get(param.getPropertyName())==null?0:map.get(param.getPropertyName()); |
| | | map.put(param.getPropertyName(), limitNum+1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | //夿ä¼è¯çµæºæ§è½ |
| | | int pwrPerformence=judgePwrPerformence(map); |
| | | return pwrPerformence; |
| | | } |
| | | //夿ä¼è¯çµæºæ§è½ |
| | | private Integer judgePwrPerformence(Map<String,Integer> map){ |
| | |
| | | warningVal=appParam.getParamValue(); |
| | | } |
| | | } |
| | | return 1; |
| | | Integer performance = PwrCapperformanceEnum.PWRSTATE_1.getStateId(); // åå§å为æä¼ç级 |
| | | for (Map.Entry<String, Integer> entry : map.entrySet()) { |
| | | Integer level = evaluateValue(entry.getValue(), excellentVal, commonlyVal, warningVal); |
| | | // æ ¹æ®ç级æåºç¡®å®å½åæ¯å¦æ¯æå·®ç级 |
| | | if (PwrCapperformanceEnum.PWRSTATE_4.getStateId()==level) { |
| | | performance = PwrCapperformanceEnum.PWRSTATE_4.getStateId(); |
| | | return performance; // 䏿¦åºç°å·®ï¼ç´æ¥è¿å |
| | | } else if (PwrCapperformanceEnum.PWRSTATE_3.getStateId()==level && PwrCapperformanceEnum.PWRSTATE_4.getStateId()!=performance) { |
| | | performance = PwrCapperformanceEnum.PWRSTATE_3.getStateId(); |
| | | } else if (PwrCapperformanceEnum.PWRSTATE_2.getStateId()==level &&(PwrCapperformanceEnum.PWRSTATE_3.getStateId()!=performance||PwrCapperformanceEnum.PWRSTATE_4.getStateId()!=performance)) { |
| | | performance = PwrCapperformanceEnum.PWRSTATE_2.getStateId(); |
| | | } |
| | | } |
| | | return performance; |
| | | } |
| | | // 夿å个å¼çç级 |
| | | public Integer evaluateValue(Integer value, Float excellentVal, Float commonlyVal, Float warningVal) { |
| | | if (value <= excellentVal) { |
| | | return PwrCapperformanceEnum.PWRSTATE_1.getStateId(); |
| | | } else if (value <= commonlyVal&&value > excellentVal) { |
| | | return PwrCapperformanceEnum.PWRSTATE_2.getStateId(); |
| | | } else if (value <= warningVal&&value > commonlyVal) { |
| | | return PwrCapperformanceEnum.PWRSTATE_3.getStateId(); |
| | | } else { |
| | | return PwrCapperformanceEnum.PWRSTATE_4.getStateId(); |
| | | } |
| | | } |
| | | } |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | //çµæ± æ°æ®åå²å®æ¶å¤ç(é¢è¦åæ) |
| | | public List<RealDateDTO> getBattHisRealInAlm(BattRealdataId realdata) { |
| | | String sql=" select record_time, group_vol, online_vol,group_curr, mon_vol, mon_tmp, mon_res, mon_num,record_num " + |
| | | " from db_data_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | | " where record_time >= '"+ThreadLocalUtil.format(realdata.getRecordTime(),1)+"' " + |
| | | " and record_time <= '"+ThreadLocalUtil.format(realdata.getRecordTime1(),1)+"' " + |
| | | " order by record_time asc,mon_num asc"; |
| | | List<RealDateDTO> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<RealDateDTO> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | RealDateDTO ph=new RealDateDTO(); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupCurr(rs.getFloat("group_curr")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonTmp(rs.getFloat("mon_tmp")); |
| | | ph.setMonRes(rs.getFloat("mon_res")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //è·åæå®æ¶é´æ®µå
æå¤§æå°recordNumç¡®ä¿æ°æ®ç宿´ |
| | | public List getMaxAndMinRecordNum(BattRealdataId realdata) { |
| | | String sql="select max(record_num) as maxRecordNum,min(record_num) as minRecordNum " + |
| | |
| | | return list; |
| | | } |
| | | //1.2.7ä¼è¯çµæºç»è®¡ä¸ä¸å£åº¦ççµæºæä¸å±æ§ååæ°éå¼è¶
è¿çæ¬¡æ° |
| | | public List<QuarterPwr7Res> getPwrQuarter7(String tableName) { |
| | | String sql=" select distinct record_datetime,acin1_vola,acout_curra,dcout_vol,dcout_curr " + |
| | | public List<PwrdevHistorydataId> getPwrQuarter7(String tableName) { |
| | | String sql=" select distinct * " + |
| | | " from "+tableName+" " ; |
| | | sql+=" order by record_datetime asc"; |
| | | List<QuarterPwr7Res> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | List<PwrdevHistorydataId> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<QuarterPwr7Res> list=new ArrayList<>(); |
| | | List<PwrdevHistorydataId> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | QuarterPwr7Res data=new QuarterPwr7Res(); |
| | | PwrdevHistorydataId data=new PwrdevHistorydataId(); |
| | | data.setRecordDatetime(rs.getTimestamp("record_datetime")); |
| | | data.setAcin1Vola(rs.getFloat("acin1_vola")); |
| | | data.setAcin1Volb(rs.getFloat("acin1_volb")); |
| | | data.setAcin1Volc(rs.getFloat("acin1_volc")); |
| | | data.setAcin2Vola(rs.getFloat("acin2_vola")); |
| | | data.setAcin2Volb(rs.getFloat("acin2_volb")); |
| | | data.setAcin2Volc(rs.getFloat("acin2_volc")); |
| | | data.setAcoutVola(rs.getFloat("acout_vola")); |
| | | data.setAcoutVolb(rs.getFloat("acout_volb")); |
| | | data.setAcoutVolc(rs.getFloat("acout_volc")); |
| | | data.setAcoutCurra(rs.getFloat("acout_curra")); |
| | | data.setAcoutCurrb(rs.getFloat("acout_currb")); |
| | | data.setAcoutCurrc(rs.getFloat("acout_currc")); |
| | | data.setDcoutVol(rs.getFloat("dcout_vol")); |
| | | data.setDcoutCurr(rs.getFloat("dcout_curr")); |
| | | |
| | | data.setBattgroup1Vol(rs.getFloat("battgroup1_vol")); |
| | | data.setBattgroup1Curr(rs.getFloat("battgroup1_curr")); |
| | | data.setBattgroup2Vol(rs.getFloat("battgroup2_vol")); |
| | | data.setBattgroup2Curr(rs.getFloat("battgroup2_curr")); |
| | | data.setTemprature(rs.getFloat("temprature")); |
| | | data.setMOutputvol(rs.getFloat("m_outputvol")); |
| | | data.setM1Outcurr(rs.getFloat("m1_outcurr")); |
| | | data.setM2Outcurr(rs.getFloat("m2_outcurr")); |
| | | data.setM3Outcurr(rs.getFloat("m3_outcurr")); |
| | | data.setM4Outcurr(rs.getFloat("m4_outcurr")); |
| | | data.setM5Outcurr(rs.getFloat("m5_outcurr")); |
| | | data.setM6Outcurr(rs.getFloat("m6_outcurr")); |
| | | data.setM7Outcurr(rs.getFloat("m7_outcurr")); |
| | | data.setM8Outcurr(rs.getFloat("m8_outcurr")); |
| | | data.setM9Outcurr(rs.getFloat("m9_outcurr")); |
| | | data.setM10Outcurr(rs.getFloat("m10_outcurr")); |
| | | data.setM11Outcurr(rs.getFloat("m11_outcurr")); |
| | | data.setM12Outcurr(rs.getFloat("m12_outcurr")); |
| | | data.setM13Outcurr(rs.getFloat("m13_outcurr")); |
| | | data.setM14Outcurr(rs.getFloat("m14_outcurr")); |
| | | data.setM15Outcurr(rs.getFloat("m15_outcurr")); |
| | | data.setM16Outcurr(rs.getFloat("m16_outcurr")); |
| | | |
| | | data.setAcin1Curra(rs.getFloat("acin1_curra")); |
| | | data.setAcin1Currb(rs.getFloat("acin1_currb")); |
| | | data.setAcin1Currc(rs.getFloat("acin1_currc")); |
| | | data.setLoaderCurr(rs.getFloat("loader_curr")); |
| | | data.setBattgroup1Ah(rs.getFloat("battgroup1_ah")); |
| | | data.setBattgroup1Temp(rs.getFloat("battgroup1_temp")); |
| | | data.setBattgroup2Ah(rs.getFloat("battgroup2_ah")); |
| | | data.setBattgroup2Temp(rs.getFloat("battgroup2_temp")); |
| | | data.setAcdcmTemp(rs.getFloat("acdcm_temp")); |
| | | data.setM1OutVol(rs.getFloat("m1_out_vol")); |
| | | data.setM2OutVol(rs.getFloat("m2_out_vol")); |
| | | data.setM3OutVol(rs.getFloat("m3_out_vol")); |
| | | data.setM4OutVol(rs.getFloat("m4_out_vol")); |
| | | data.setM5OutVol(rs.getFloat("m5_out_vol")); |
| | | data.setM6OutVol(rs.getFloat("m6_out_vol")); |
| | | data.setM7OutVol(rs.getFloat("m7_out_vol")); |
| | | data.setM8OutVol(rs.getFloat("m8_out_vol")); |
| | | data.setM9OutVol(rs.getFloat("m9_out_vol")); |
| | | data.setM10OutVol(rs.getFloat("m10_out_vol")); |
| | | data.setM11OutVol(rs.getFloat("m11_out_vol")); |
| | | data.setM12OutVol(rs.getFloat("m12_out_vol")); |
| | | data.setM13OutVol(rs.getFloat("m13_out_vol")); |
| | | data.setM14OutVol(rs.getFloat("m14_out_vol")); |
| | | data.setM15OutVol(rs.getFloat("m15_out_vol")); |
| | | data.setM16OutVol(rs.getFloat("m16_out_vol")); |
| | | |
| | | data.setUseracin1Vola(rs.getFloat("useracin1_vola")); |
| | | data.setUseracin1Volb(rs.getFloat("useracin1_volb")); |
| | | data.setUseracin1Volc(rs.getFloat("useracin1_volc")); |
| | | data.setUseracin1Curra(rs.getFloat("useracin1_curra")); |
| | | data.setUseracin1Currb(rs.getFloat("useracin1_currb")); |
| | | data.setUseracin1Currc(rs.getFloat("useracin1_currc")); |
| | | data.setUseracin1Freq(rs.getFloat("useracin1_freq")); |
| | | data.setUseracin2Vola(rs.getFloat("useracin2_vola")); |
| | | data.setUseracin2Volb(rs.getFloat("useracin2_volb")); |
| | | data.setUseracin2Volc(rs.getFloat("useracin2_volc")); |
| | | data.setUseracin2Curra(rs.getFloat("useracin2_curra")); |
| | | data.setUseracin2Currb(rs.getFloat("useracin2_currb")); |
| | | data.setUseracin2Currc(rs.getFloat("useracin2_currc")); |
| | | data.setUseracin2Freq(rs.getFloat("useracin2_freq")); |
| | | |
| | | data.setMTemper1(rs.getFloat("m_temper1")); |
| | | data.setMTemper2(rs.getFloat("m_temper2")); |
| | | data.setMTemper3(rs.getFloat("m_temper3")); |
| | | data.setMHumidity1(rs.getFloat("m_humidity1")); |
| | | data.setMHumidity2(rs.getFloat("m_humidity2")); |
| | | data.setMHumidity3(rs.getFloat("m_humidity3")); |
| | | list.add(data); |
| | | } |
| | | return list; |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.mapper.WorkflowDeviceMapper; |
| | | import com.whyc.pojo.web_site.WorkflowDevice; |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class WorkflowDeviceService { |
| | | |
| | | @Autowired |
| | | private WorkflowDeviceMapper mapper; |
| | | |
| | | public void addBatch(List<WorkflowDevice> deviceList) { |
| | | mapper.insertBatchSomeColumn(deviceList); |
| | | } |
| | | |
| | | public List<WorkflowDevice> getByMainId(Integer relatedId) { |
| | | QueryWrapper<WorkflowDevice> query = Wrappers.query(); |
| | | query.eq("main_id",relatedId); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public void setQuantityUnprocessedZero(Integer relatedId) { |
| | | UpdateWrapper<WorkflowDevice> update = Wrappers.update(); |
| | | update.set("quantity_unprocessed",0).eq("main_id",relatedId); |
| | | mapper.update((WorkflowDevice) ActionUtil.objeNull,update); |
| | | } |
| | | |
| | | public void updateQuantityUnprocessedBatch(List<WorkflowDevice> deviceRelatedListInDB) { |
| | | for (int i = 0; i < deviceRelatedListInDB.size(); i++) { |
| | | WorkflowDevice deviceRelatedInDB = deviceRelatedListInDB.get(i); |
| | | UpdateWrapper<WorkflowDevice> update = Wrappers.update(); |
| | | update.set("quantity_unprocessed",deviceRelatedInDB.getQuantityUnprocessed()) |
| | | .eq("id",deviceRelatedInDB.getId()); |
| | | mapper.update((WorkflowDevice) ActionUtil.objeNull,update); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.WorkflowEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowDevice; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.util.CommonUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class WorkflowLinkService { |
| | | |
| | | @Resource |
| | | private WorkflowLinkMapper mapper; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private WorkflowMainService mainService; |
| | | |
| | | @Autowired |
| | | private WorkflowDeviceService deviceService; |
| | | |
| | | |
| | | public void addBatch(List<WorkflowLink> links) { |
| | | mapper.insertBatchSomeColumn(links); |
| | | } |
| | | |
| | | public List<WorkflowLink> getWorkflowInfo(Integer mainId) { |
| | | QueryWrapper<WorkflowLink> wrapper = Wrappers.query(); |
| | | wrapper.eq("main_id", mainId); |
| | | return mapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Transactional |
| | | public Response updateLink(WorkflowLink link) { |
| | | //è·åå½åèç¹çè®°å½ |
| | | WorkflowLink linkInDB = mapper.selectById(link.getId()); |
| | | User user = CommonUtil.getUser(); |
| | | Date now = new Date(); |
| | | //æ ¹æ®id.æ¥è¯¢å
³èç主表 |
| | | WorkflowMain mainInDB = mainService.getById(linkInDB.getMainId()); |
| | | //æ¥çç³è¯·æµç¨ç±»å |
| | | switch (mainInDB.getType()) { |
| | | case 1: { //设å¤ç»´ä¿®ç³è¯· |
| | | //æ¥ç主表çç¶æ |
| | | //å 为æ¯å个é¾è·¯èç¹,æä»¥ä¸éè¦å¤ææ¯ä¸æ¯å¾
å¤ç,è¯å®åªæ1个èç¹. 审æ¹éè¿æè
驳å |
| | | //if(main.getStatus() == WorkflowEnum.MAIN_STATUS_DEALING.getValue().intValue()){ //å¾
å¤ç,ä¸ä¸æ¥æ¯å®¡æ¹éè¿,å¾
å¤ç æè
驳å |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainService.updateById(mainInDB); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | //设å¤å
¥åºç³è¯· |
| | | case 2: |
| | | //è®¾å¤æ¥åºç³è¯· |
| | | case 3:{ |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_PASS.getValue()); |
| | | mainInDB.setEndTime(now); |
| | | mainInDB.setEndReason(link.getDealReason()); |
| | | mainService.updateById(mainInDB); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | //æ£æ¥æ¯å¦æå
³èå·¥å. |
| | | // 妿æå
³èå·¥å,å
³èå·¥åç¶æé置为å®ç»å¾
å¤ç,宿æ¶é´é置为空 |
| | | if(mainInDB.getRelatedId() != null){ |
| | | Integer relatedId = mainInDB.getRelatedId(); |
| | | mainService.resetRepairStatus(relatedId); |
| | | //å
³èå·¥åç设å¤éå±è¡¨æªå¤çæ°éä¹è¦åé,çäºä¸»è¡¨è®¾å¤æ°é |
| | | List<WorkflowDevice> deviceRelatedListInDB = deviceService.getByMainId(mainInDB.getRelatedId()); |
| | | List<WorkflowDevice> deviceListInDB = deviceService.getByMainId(mainInDB.getId()); |
| | | for (int i = 0; i < deviceListInDB.size(); i++) { |
| | | WorkflowDevice deviceInDB = deviceListInDB.get(i); |
| | | for (int j = 0; j < deviceRelatedListInDB.size(); j++) { |
| | | WorkflowDevice deviceRelatedInDB = deviceRelatedListInDB.get(j); |
| | | if (deviceInDB.getName().equals(deviceRelatedInDB.getName()) |
| | | && deviceInDB.getModel().equals(deviceRelatedInDB.getModel()) |
| | | && deviceInDB.getVersion().equals(deviceRelatedInDB.getVersion()) |
| | | && deviceInDB.getBrand().equals(deviceRelatedInDB.getBrand()) |
| | | && deviceInDB.getType().equals(deviceRelatedInDB.getType()) |
| | | && deviceInDB.getSupplier().equals(deviceRelatedInDB.getSupplier()) |
| | | ) { |
| | | deviceRelatedInDB.setQuantityUnprocessed(deviceInDB.getQuantity()); |
| | | //å
³èå·¥åå½å设å¤éå±çæªå¤çæ°éåé宿,ä¸ä¸ä¸ª |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | deviceService.updateQuantityUnprocessedBatch(deviceRelatedListInDB); |
| | | } |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | case 4:{ //TODO åºåºç³è¯· |
| | | if(link.getStatus() == WorkflowEnum.LINK_STATUS_PASS.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()); |
| | | mainService.updateById(mainInDB); |
| | | }else if(link.getStatus() == WorkflowEnum.LINK_STATUS_REJECT.getValue().intValue()){ |
| | | mainInDB.setStatus(WorkflowEnum.MAIN_STATUS_END_REJECT.getValue()); |
| | | mainInDB.setEndReason(link.getDealRejectReason()); |
| | | mainInDB.setEndTime(now); |
| | | //æ£æ¥æ¯å¦æå
³èå·¥å.妿æå
³èå·¥å,å
³èå·¥åç¶æé置为å®ç»å¾
å¤ç,宿æ¶é´é置为空 |
| | | if(mainInDB.getRelatedId() != null){ |
| | | Integer relatedId = mainInDB.getRelatedId(); |
| | | //mainService.resetRepairStatus(relatedId,mainInDB.getQuantity()); |
| | | } |
| | | mainService.updateById(mainInDB); |
| | | link.setDealAndClose(1); |
| | | } |
| | | }break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | |
| | | link.setId(linkInDB.getId()); |
| | | link.setDealUserId(user.getId()); |
| | | link.setDealTime(now); |
| | | |
| | | mapper.updateById(link); |
| | | |
| | | return new Response().setII(1,"æ´æ°å®æ"); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param mainId ç¹å®çåæ® |
| | | * @param processLevel ç¹å®çè¿ç¨ |
| | | * @return ç¹å®åæ®,ç¹å®è¿ç¨,æªå®æçä¼ç¾çæ°é |
| | | */ |
| | | private int getLeftAssignNum(Integer mainId, String processLevel) { |
| | | QueryWrapper<WorkflowLink> query = Wrappers.query(); |
| | | query.select("count(*) as id").eq("main_id",mainId).eq("process_level",processLevel).ne("status",WorkflowEnum.LINK_STATUS_PASS.getValue()); |
| | | return mapper.selectOne(query).getId(); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°èç¹,主èç¹ä¸å®ç» |
| | | * @param link åæ°id,status,dealReasonæè
dealRejectReason |
| | | */ |
| | | private void updateLinkField(WorkflowLink link) { |
| | | Date now = new Date(); |
| | | link.setDealTime(now); |
| | | mapper.updateById(link); |
| | | } |
| | | |
| | | |
| | | public Map<Integer, Integer> getReceivedStatistics(int type, User user) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(1,0); |
| | | statistics.put(6,0); |
| | | statistics.put(58,0); |
| | | List<WorkflowLink> links = mapper.getReceivedList(type,user); |
| | | Map<Integer, List<WorkflowLink>> receivedListMap = links.stream().collect(Collectors.groupingBy(WorkflowLink::getStatus)); |
| | | Set<Integer> statusSet = receivedListMap.keySet(); |
| | | for (Integer status : statusSet) { |
| | | if (status == 5 || status == 8) { |
| | | statistics.put(58, statistics.get(58) + receivedListMap.get(status).size()); |
| | | } else { |
| | | statistics.put(status, receivedListMap.get(status).size()); |
| | | } |
| | | } |
| | | return statistics; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * äºæ¬¡æ ¸å®¹å鿣æ
éçç»è®¡ |
| | | * |
| | | * å¢å äºå
¨é¨ 0 |
| | | * 0:å
¨é¨ |
| | | * 1:审æ¹ä¸ |
| | | * 2:éè¿ |
| | | * 3:驳å |
| | | * |
| | | * statuså«ä¹:1-å¾
æ¥å,6-å¾
å®¡æ ¸,58-å·²å®¡æ ¸ |
| | | * @param type |
| | | * @param user |
| | | * @return |
| | | */ |
| | | public Response getReceivedStatistics2(int type, User user) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(0,0); |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | List<WorkflowLink> links = mapper.getReceivedList2(type,user); |
| | | Map<Integer, List<WorkflowLink>> receivedListMap = links.stream().collect(Collectors.groupingBy(WorkflowLink::getStatus)); |
| | | Set<Integer> statusSet = receivedListMap.keySet(); |
| | | int sum = 0; |
| | | for (Integer status : statusSet) { |
| | | int size = receivedListMap.get(status).size(); |
| | | if (status == 1 || status == 6) { //审æ¹ä¸ |
| | | statistics.put(1, statistics.get(1) + size); |
| | | } else if(status == 5){ //éè¿ |
| | | statistics.put(2, size); |
| | | }else if(status == 8){ //驳å |
| | | statistics.put(3,size); |
| | | } |
| | | sum+=size; |
| | | } |
| | | statistics.put(0,sum); |
| | | return new Response().set(1,statistics); |
| | | } |
| | | |
| | | |
| | | public void add(WorkflowLink link) { |
| | | mapper.insert(link); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.WorkflowEnum; |
| | | import com.whyc.constant.WorkflowProcessEnum; |
| | | import com.whyc.constant.WorkflowTypeEnum; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.WorkflowMainMapper; |
| | | import com.whyc.pojo.db_user.User; |
| | | import com.whyc.pojo.web_site.WorkflowDevice; |
| | | import com.whyc.pojo.web_site.WorkflowLink; |
| | | import com.whyc.pojo.web_site.WorkflowMain; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletContext; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class WorkflowMainService { |
| | | |
| | | @Resource |
| | | private WorkflowMainMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private WorkflowLinkService linkService; |
| | | |
| | | @Autowired |
| | | private WorkflowDeviceService deviceService; |
| | | |
| | | |
| | | /** |
| | | * åæ´¾åå·: |
| | | * */ |
| | | public String getNextOrderId(String typeName) { |
| | | ServletContext application = ActionUtil.getApplication(); |
| | | List<String> orderIdList = (List) application.getAttribute("orderIdList"); |
| | | if(orderIdList == null){ |
| | | orderIdList = new LinkedList<>(); |
| | | } |
| | | String nextSequence = ""; |
| | | QueryWrapper<WorkflowMain> wrapper = Wrappers.query(); |
| | | |
| | | String orderId = typeName+"-"; |
| | | String ymd = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | orderId = orderId+ymd+"-"; |
| | | //å
æ¥è¯¢æ¯å¦ç¼å䏿¯å¦åå¨åç¼ç¸åçåå·,æçè¯åèµ·æ¥ |
| | | List<Integer> sequenceList = new LinkedList<>(); |
| | | sequenceList.add(0); |
| | | for (String item : orderIdList) { |
| | | if(item.startsWith(orderId)){ |
| | | String sequence = item.split("-")[3]; |
| | | sequenceList.add(Integer.parseInt(sequence)); |
| | | } |
| | | } |
| | | wrapper.likeRight("order_id",orderId).orderByDesc("order_id").last(" limit 1"); |
| | | WorkflowMain workflowMain = mapper.selectOne(wrapper); |
| | | if(workflowMain != null){ |
| | | String sequence = workflowMain.getOrderId().split("-")[3]; |
| | | sequenceList.add(Integer.parseInt(sequence)); |
| | | } |
| | | Integer maxSequence = sequenceList.stream().max(Comparator.comparing(Integer::intValue)).get(); |
| | | nextSequence = String.format("%05d", maxSequence+1); |
| | | String nextOrderId = orderId + nextSequence; |
| | | //å å
¥ç¼åä¸ |
| | | orderIdList.add(nextOrderId); |
| | | application.setAttribute("orderIdList",orderIdList); |
| | | return nextOrderId; |
| | | } |
| | | |
| | | public void add(WorkflowMain main) { |
| | | mapper.insert(main); |
| | | } |
| | | |
| | | public void addBatch(List<WorkflowMain> workflowMainList) { |
| | | mapper.insertBatchSomeColumn(workflowMainList); |
| | | } |
| | | |
| | | |
| | | public WorkflowMain getBaseInfo(Integer mainId) { |
| | | //æ ¹æ®mainIdæ¥è¯¢æ¯åªç§ç±»å |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("id",mainId).last(" limit 1"); |
| | | WorkflowMain workflowMain = mapper.selectOne(query); |
| | | Integer type = workflowMain.getType(); |
| | | if(type ==1){ |
| | | //List<BattDischargePlanTemp> tempList = tempService.getListByMainId(mainId); |
| | | //workflowMain.setTempList(tempList); |
| | | } |
| | | List<WorkflowLink> linkList = linkService.getWorkflowInfo(mainId); |
| | | workflowMain.setLinkList(linkList); |
| | | |
| | | return workflowMain; |
| | | } |
| | | |
| | | public List<WorkflowLink> getAssignReply(Integer mainId) { |
| | | QueryWrapper<WorkflowLink> wrapper = Wrappers.query(); |
| | | //wrapper.eq("main_id",mainId) |
| | | //return linkMapper. |
| | | return null; |
| | | } |
| | | |
| | | public void updateById(WorkflowMain main) { |
| | | mapper.updateById(main); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param userId |
| | | * @param type |
| | | * @see WorkflowEnum |
| | | * |
| | | * @return |
| | | */ |
| | | public Response<Map<Integer,Integer>> getOwnStatistics(int userId, int type) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id",userId).eq("type",type); |
| | | List<WorkflowMain> mains = mapper.selectList(query); |
| | | Map<Integer, List<WorkflowMain>> statusListMap = mains.stream().collect(Collectors.groupingBy(WorkflowMain::getStatus)); |
| | | Set<Integer> statusSet = statusListMap.keySet(); |
| | | for (Integer status : statusSet) { |
| | | statistics.put(status,statusListMap.get(status).size()); |
| | | } |
| | | return new Response<Map<Integer,Integer>>().set(1,statistics); |
| | | } |
| | | |
| | | /** |
| | | * äºæ¬¡æ ¸å®¹åæ
é鿣çç»è®¡ |
| | | * |
| | | * å¢å äºå
¨é¨ key=0 |
| | | * @param type ={0,2,3} 0ä»£è¡¨äºæ¬¡æ ¸å®¹åæ
é鿣ä¸èµ· |
| | | * @see WorkflowEnum |
| | | * |
| | | * @return |
| | | */ |
| | | public Response<Map<Integer,Integer>> getOwnStatistics2(int userId, int type) { |
| | | Map<Integer,Integer> statistics = new HashMap<>(); |
| | | statistics.put(0,0); |
| | | statistics.put(1,0); |
| | | statistics.put(2,0); |
| | | statistics.put(3,0); |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | query.eq("create_user_id", userId); |
| | | if(type == 0){ |
| | | query.in("type",2,3); |
| | | }else { |
| | | query.eq("type", type); |
| | | } |
| | | List<WorkflowMain> mains = mapper.selectList(query); |
| | | Map<Integer, List<WorkflowMain>> statusListMap = mains.stream().collect(Collectors.groupingBy(WorkflowMain::getStatus)); |
| | | Set<Integer> statusSet = statusListMap.keySet(); |
| | | int sum = 0; |
| | | for (Integer status : statusSet) { |
| | | int size = statusListMap.get(status).size(); |
| | | statistics.put(status, size); |
| | | sum+=size; |
| | | } |
| | | statistics.put(0,sum); |
| | | return new Response<Map<Integer,Integer>>().set(1,statistics); |
| | | } |
| | | |
| | | public Response<PageInfo<WorkflowMain>> ownListPage(int userId, int type, int status, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorkflowMain> mains = getOwnListByUserAndType(userId,type,status); |
| | | if(type == 1) { |
| | | for (WorkflowMain main : mains) { |
| | | Integer id = main.getId(); |
| | | //List<BattDischargePlanTemp> tempList = tempService.getListByMainId(id); |
| | | //main.setTempList(tempList); |
| | | } |
| | | } |
| | | PageInfo<WorkflowMain> pageInfo = new PageInfo<>(mains); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1,pageInfo); |
| | | } |
| | | |
| | | private List<WorkflowMain> getOwnListByUserAndType(int userId, int type, int status) { |
| | | QueryWrapper<WorkflowMain> query = Wrappers.query(); |
| | | if(status == 0){ |
| | | query.eq("create_user_id",userId).eq("type",type).orderByDesc("id"); |
| | | }else { |
| | | query.eq("create_user_id", userId).eq("type", type).eq("status", status).orderByDesc("id"); |
| | | } |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public Response<Map<Integer,Integer>> getReceivedStatistics(int type, User user) { |
| | | Map<Integer,Integer> statisticsMap = linkService.getReceivedStatistics(type,user); |
| | | return new Response<Map<Integer,Integer>>().set(1,statisticsMap); |
| | | } |
| | | |
| | | public Response<PageInfo<WorkflowMain>> getReceivedListPage(int type, int status, User user, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<WorkflowMain> mains = getReceivedListByUserAndType(user,type,status); |
| | | if (type == 1) { |
| | | for (WorkflowMain main : mains) { |
| | | Integer id = main.getId(); |
| | | //List<BattDischargePlanTemp> tempList = tempService.getListByMainId(id); |
| | | //main.setTempList(tempList); |
| | | } |
| | | } |
| | | PageInfo<WorkflowMain> pageInfo = new PageInfo<>(mains); |
| | | return new Response<PageInfo<WorkflowMain>>().set(1, pageInfo); |
| | | } |
| | | |
| | | private List<WorkflowMain> getReceivedListByUserAndType(User user, int type, int status) { |
| | | return mapper.getReceivedListByUserAndType(user, type, status); |
| | | } |
| | | |
| | | public WorkflowMain getById(Integer mainId) { |
| | | return mapper.selectById(mainId); |
| | | } |
| | | |
| | | //æ¥è¯¢è¡¨åç¼å· |
| | | public int getMaxId() { |
| | | Integer id = mapper.getMaxId(); |
| | | if (id == null) { |
| | | id = 1; |
| | | } else { |
| | | id = id + 1; |
| | | } |
| | | return id; |
| | | } |
| | | |
| | | /** |
| | | * éç¨æäº¤æ¹æ³,æäº¤ç»è§è²-è§è²å± |
| | | * 妿related_idä¸ä¸ºç©º,åéè¦ç¹æ®å¤ç. è¯æä¼å½±åå°å
³èåæ® |
| | | * |
| | | * æ¶åå°æ°çé®é¢éè¦è§£å³,ç°åºæ
éå,设å¤ç»´ä¿®ç³è¯· æ æ¥åºç³è¯· æ¯å¤ä¸ª,å¹¶åå
¥å·¥å设å¤è¡¨ä¸. å¹¶ä¸åªæ¯åçº¯çæ°é. TODO ?èªå¨åå¤çæä¹æ´æ° |
| | | */ |
| | | |
| | | @Transactional |
| | | public Response submit(WorkflowMain main){ |
| | | //1.æäº¤å°åæ®å®¡æ¹æµç¨ |
| | | //妿åå¨å
³èåæ®id,é¦å
æ ¡éªæäº¤çæ°é |
| | | Date now = new Date(); |
| | | List<WorkflowDevice> deviceListRelatedInDB = deviceService.getByMainId(main.getRelatedId()); |
| | | List<WorkflowDevice> deviceList = main.getDeviceList(); |
| | | if(main.getRelatedId() != null) { |
| | | //éådeviceList,妿deviceListå
ç对象çquantityå¼å¤§äº deviceListRelatedInDBå
对象å表ä¸ç对象ææå段ç¸åçè®°å½çquantityUnprocessedå¼,åè¿åé误 |
| | | for (int i = 0; i < deviceList.size(); i++) { |
| | | WorkflowDevice device = deviceList.get(i); |
| | | for (int j = 0; j < deviceListRelatedInDB.size(); j++) { |
| | | WorkflowDevice deviceInDB = deviceListRelatedInDB.get(j); |
| | | if (device.getName().equals(deviceInDB.getName()) |
| | | && device.getModel().equals(deviceInDB.getModel()) |
| | | && device.getVersion().equals(deviceInDB.getVersion()) |
| | | && device.getBrand().equals(deviceInDB.getBrand()) |
| | | && device.getType().equals(deviceInDB.getType()) |
| | | && device.getSupplier().equals(deviceInDB.getSupplier()) |
| | | ) { |
| | | if (device.getQuantity() > deviceInDB.getQuantityUnprocessed()) { |
| | | return new Response().setII(1, "å
¥åºæ°éä¸è½å¤§äºç»´ä¿®ç³è¯·å
³èåæ®çæªå¤çæ°é"); |
| | | }else{ |
| | | //å½å设å¤çæ ¡éªç»æ,è¿å
¥ä¸ä¸ä¸ªè®¾å¤æ ¡éª |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | //主表æå
¥ |
| | | //åå§åç¸å
³å段 |
| | | WorkflowTypeEnum typeEnum = WorkflowTypeEnum.getByType(main.getType()); |
| | | String name = typeEnum.getName(); |
| | | String namingPrefix = typeEnum.getNamingPrefix(); |
| | | String orderId = getNextOrderId(namingPrefix); |
| | | //String title = mainTypeCN+"审æ¹å-"+ DateUtil.YYYY_MM_DD_HH_MM_SS.format(now); |
| | | |
| | | String title = name + ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS, now); |
| | | Integer mainStatus = WorkflowEnum.MAIN_STATUS_DEALING.getValue(); |
| | | User user = CommonUtil.getUser(); |
| | | WorkflowProcessEnum process = getProcessLevel(main.getType(),user.getRole()); |
| | | main.setOrderId(orderId); |
| | | main.setTitle(title); |
| | | main.setCreateUserId(user.getId()); |
| | | main.setCreateTime(now); |
| | | main.setBeginTime(now); |
| | | main.setStatus(mainStatus); |
| | | main.setProcessStage(process.getStage()); |
| | | if(main.getType() == WorkflowTypeEnum.DEVICE_REPAIR.getType().intValue()){ //ç»´ä¿®ç³è¯·å,éå¡«å
¥ |
| | | for (int i = 0; i < deviceList.size(); i++) { |
| | | deviceList.get(i).setQuantityUnprocessed(deviceList.get(i).getQuantity()); |
| | | } |
| | | } |
| | | add(main); |
| | | //主表å
³èçç©ææå
¥ |
| | | for (WorkflowDevice device : deviceList) { |
| | | device.setMainId(main.getId()); |
| | | } |
| | | deviceService.addBatch(deviceList); |
| | | |
| | | //å
åä¸å»é¤å·²æå
¥æ°æ®åºçåå· |
| | | ServletContext application = ActionUtil.getApplication(); |
| | | List<String> orderIdList = (List<String>) application.getAttribute("orderIdList"); |
| | | //æ ¡éªæ¯å¦å»é¤ |
| | | boolean remove = orderIdList.remove(orderId); |
| | | if(!remove){ |
| | | System.err.println("没æå»é¤æ!!!!!!!!!!!!!"); |
| | | } |
| | | application.setAttribute("orderIdList",orderIdList); |
| | | |
| | | //èç¹è¡¨æå
¥ |
| | | WorkflowLink link = new WorkflowLink(); |
| | | link.setMainId(main.getId()); |
| | | link.setParentId(0); |
| | | link.setProcessStage(process.getStage()); |
| | | link.setProcessName(process.getName()); |
| | | link.setCreateTime(now); |
| | | link.setDealRoleId(getNextDealRoleId(process.getName())); |
| | | link.setDealType(WorkflowEnum.TYPE_DELIVER.getValue()); |
| | | link.setDealDesc(main.getTaskDesc()); |
| | | link.setStatus(WorkflowEnum.LINK_STATUS_TAKING.getValue()); |
| | | |
| | | linkService.add(link); |
| | | |
| | | //妿åå¨å
³èåæ®id,å¤çå
³èåæ®åèªå¨çææ°åæ® |
| | | checkRelatedAndDone(main, now, deviceListRelatedInDB, user); |
| | | return new Response().setII(1,"æäº¤å®æ"); |
| | | } |
| | | |
| | | private void checkRelatedAndDone(WorkflowMain main, Date now, List<WorkflowDevice> deviceListRelatedInDB, User user) { |
| | | if(main.getRelatedId() != null){ |
| | | //ç³è¯·çæ°é<å
³èåæ®çæªå¤çæ°é,å说ææå©ä½. éè¦èªå¨çæå¯¹ç«å·¥å |
| | | List<WorkflowDevice> deviceList = main.getDeviceList(); |
| | | //计ç®deviceListnå
quantity屿§å¼çå |
| | | int sumQuantity = 0; |
| | | for (WorkflowDevice device : deviceList) { |
| | | sumQuantity += device.getQuantity(); |
| | | } |
| | | //计ç®deviceListRelatedInDBnå
quantityUnprocessed屿§å¼çå |
| | | int sumQuantityUnprocessedInDB = 0; |
| | | for (WorkflowDevice device : deviceListRelatedInDB) { |
| | | sumQuantityUnprocessedInDB += device.getQuantityUnprocessed(); |
| | | } |
| | | if (sumQuantity < sumQuantityUnprocessedInDB){ //说æéè¦èªå¨çæå
¥åºæè
æ¥åºåæ® |
| | | //éè¦èªå¨çææ¥åºçç³è¯· |
| | | WorkflowMain mainAuto = new WorkflowMain(); |
| | | WorkflowTypeEnum typeEnumAuto; |
| | | |
| | | Integer statusAuto = WorkflowEnum.MAIN_STATUS_DEALING.getValue(); |
| | | WorkflowProcessEnum processAuto = WorkflowProcessEnum.PROCESS_MANAGER1SIGN; |
| | | mainAuto.setCreateUserId(user.getId()); |
| | | mainAuto.setCreateTime(now); |
| | | mainAuto.setBeginTime(now); |
| | | mainAuto.setProcessStage(processAuto.getStage()); |
| | | mainAuto.setStatus(statusAuto); |
| | | mainAuto.setRelatedId(main.getRelatedId()); |
| | | //æ´ç主表ç设å¤é表 |
| | | List<WorkflowDevice> deviceListAuto = new ArrayList<>(); |
| | | //éådeviceListRelatedInDB,åå»deviceListä¸ç³è¯·çæ°é |
| | | for (WorkflowDevice deviceInDB : deviceListRelatedInDB) { |
| | | boolean deviceExists = false; |
| | | for (WorkflowDevice device : deviceList) { |
| | | if (device.getName().equals(deviceInDB.getName()) |
| | | && device.getModel().equals(deviceInDB.getModel()) |
| | | && device.getVersion().equals(deviceInDB.getVersion()) |
| | | && device.getBrand().equals(deviceInDB.getBrand()) |
| | | && device.getType().equals(deviceInDB.getType()) |
| | | && device.getSupplier().equals(deviceInDB.getSupplier()) |
| | | ){ |
| | | deviceExists = true; |
| | | if (deviceInDB.getQuantityUnprocessed()-device.getQuantity() > 0){ |
| | | WorkflowDevice deviceAuto = new WorkflowDevice(); |
| | | deviceAuto.setName(deviceInDB.getName()); |
| | | deviceAuto.setModel(deviceInDB.getModel()); |
| | | deviceAuto.setVersion(deviceInDB.getVersion()); |
| | | deviceAuto.setQuantity(deviceInDB.getQuantityUnprocessed()-device.getQuantity()); |
| | | deviceAuto.setBrand(deviceInDB.getBrand()); |
| | | deviceAuto.setType(deviceInDB.getType()); |
| | | deviceAuto.setSupplier(deviceInDB.getSupplier()); |
| | | |
| | | deviceListAuto.add(deviceAuto); |
| | | }else{ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (!deviceExists){ |
| | | WorkflowDevice deviceAuto = new WorkflowDevice(); |
| | | deviceAuto.setName(deviceInDB.getName()); |
| | | deviceAuto.setModel(deviceInDB.getModel()); |
| | | deviceAuto.setVersion(deviceInDB.getVersion()); |
| | | deviceAuto.setQuantity(deviceInDB.getQuantityUnprocessed()); |
| | | deviceAuto.setBrand(deviceInDB.getBrand()); |
| | | deviceAuto.setType(deviceInDB.getType()); |
| | | deviceAuto.setSupplier(deviceInDB.getSupplier()); |
| | | |
| | | deviceListAuto.add(deviceAuto); |
| | | } |
| | | } |
| | | |
| | | if(main.getType() == WorkflowTypeEnum.DEVICE_IN.getType().intValue()) { //ç³è¯·çå
¥åº |
| | | mainAuto.setTaskDesc("æäº¤äºç»´ä¿®åçå
¥åºç³è¯·,ç³»ç»èªå¨çæå©ä½æ°éçæ¥åºç³è¯·"); |
| | | typeEnumAuto = WorkflowTypeEnum.DEVICE_SCRAP; |
| | | }else { //ç³è¯·çæ¥åº |
| | | mainAuto.setTaskDesc("æäº¤äºç»´ä¿®åçæ¥åºç³è¯·,ç³»ç»èªå¨çæå©ä½æ°éçå
¥åºç³è¯·"); |
| | | typeEnumAuto = WorkflowTypeEnum.DEVICE_IN; |
| | | } |
| | | mainAuto.setOrderId(getNextOrderId(typeEnumAuto.getNamingPrefix())); |
| | | String titleAuto = typeEnumAuto.getName() + ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS, now); |
| | | mainAuto.setTitle(titleAuto); |
| | | mainAuto.setType(typeEnumAuto.getType()); |
| | | add(mainAuto); |
| | | deviceListAuto.forEach(device -> { |
| | | device.setMainId(mainAuto.getId()); |
| | | }); |
| | | //æå
¥ä¸»è¡¨ç设å¤é表 |
| | | deviceService.addBatch(deviceListAuto); |
| | | |
| | | //èªå¨èç¹çæ |
| | | WorkflowLink linkAuto = new WorkflowLink(); |
| | | linkAuto.setParentId(0); |
| | | linkAuto.setProcessStage(processAuto.getStage()); |
| | | linkAuto.setProcessName(processAuto.getName()); |
| | | linkAuto.setCreateTime(now); |
| | | linkAuto.setDealRoleId(getNextDealRoleId(processAuto.getName())); |
| | | linkAuto.setDealType(WorkflowEnum.TYPE_DELIVER.getValue()); |
| | | linkAuto.setStatus(WorkflowEnum.LINK_STATUS_TAKING.getValue()); |
| | | linkAuto.setMainId(mainAuto.getId()); |
| | | linkAuto.setDealDesc(mainAuto.getTaskDesc()); |
| | | linkService.add(linkAuto); |
| | | |
| | | } |
| | | //å
³éå
³èåæ®çç¶æ |
| | | WorkflowMain relatedMain = new WorkflowMain(); |
| | | relatedMain.setId(main.getRelatedId()); |
| | | relatedMain.setStatus(WorkflowEnum.MAIN_STATUS_END_DEALT.getValue()); |
| | | relatedMain.setEndTime(now); |
| | | if(main.getType() == WorkflowTypeEnum.DEVICE_IN.getType().intValue()) { |
| | | relatedMain.setEndReason("ç¨æ·æäº¤ç»´ä¿®ç³è¯·åçå
¥åºç³è¯·,ç»´ä¿®æµç¨ç»æ"); |
| | | }else{ |
| | | relatedMain.setEndReason("ç¨æ·æäº¤ç»´ä¿®ç³è¯·åçæ¥åºç³è¯·,ç»´ä¿®æµç¨ç»æ"); |
| | | } |
| | | updateById(relatedMain); |
| | | //æ´æ°å
³èåæ®ç设å¤å©ä½æªå¤çæ°é为0 |
| | | deviceService.setQuantityUnprocessedZero(main.getRelatedId()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * TODO æ¯æ¬¡æ°å¢æµç¨æ¶,éè¦æç»ç»´æ¤ |
| | | * 妿åç»åå¨ä¼ç¾,åéè¦è¿½å ä¸ä¸ªå¤typeç±»åçååæ¹æ³ |
| | | * @param processLevelName æµç¨é¶æ®µå |
| | | * @return æµç¨å¤ççä¸ä¸ä¸ªè§è² |
| | | */ |
| | | private Integer getNextDealRoleId(String processLevelName) { |
| | | WorkflowProcessEnum processEnum = WorkflowProcessEnum.getByName(processLevelName); |
| | | switch (processEnum){ |
| | | //è§è²:1æ®éç¨æ·ï¼2管çå±ï¼3é¢å¯¼å±ï¼4è¿ç»´çç» |
| | | case PROCESS_MANAGER1SIGN: |
| | | return 2; |
| | | default: |
| | | return 2; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * TODO æ¯æ¬¡æ°å¢æµç¨æ¶,éè¦æç»ç»´æ¤ |
| | | * @param type æµç¨çç±»å |
| | | * @param roleId ç°å¨çè§è² |
| | | * @return æµç¨å¤ççä¸ä¸ä¸ªè§è² |
| | | */ |
| | | private WorkflowProcessEnum getProcessLevel(Integer type,Integer roleId) { |
| | | WorkflowTypeEnum typeEnum = WorkflowTypeEnum.getByType(type); |
| | | String name = typeEnum.getName(); |
| | | //è§è²:1æ®éç¨æ·ï¼2管çå±ï¼3é¢å¯¼å±ï¼4è¿ç»´çç» |
| | | switch (name){ |
| | | //审æ¹é¡ºåºä¸º æ®éç¨æ·->管çå ->æ®éç¨æ·(è¿è¡å®ç») |
| | | case "设å¤ç»´ä¿®ç³è¯·å": |
| | | case "设å¤å
¥åºç³è¯·å": |
| | | case "è®¾å¤æ¥åºç³è¯·å": |
| | | case "设å¤åºåºç³è¯·å": |
| | | if (roleId == 1) { |
| | | return WorkflowProcessEnum.PROCESS_MANAGER1SIGN; |
| | | } |
| | | default: |
| | | return WorkflowProcessEnum.PROCESS_SPECIALIST; |
| | | } |
| | | } |
| | | |
| | | public void updateProcessLevel(String processLevel, Integer mainId) { |
| | | UpdateWrapper<WorkflowMain> update = Wrappers.update(); |
| | | update.set("process_level",processLevel).eq("id",mainId); |
| | | mapper.update((WorkflowMain) ActionUtil.objeNull,update); |
| | | } |
| | | |
| | | public void resetRepairStatus(Integer relatedId) { |
| | | UpdateWrapper<WorkflowMain> update = Wrappers.update(); |
| | | update.set("status",WorkflowEnum.MAIN_STATUS_WAIT_FOR_DEALING.getValue()) |
| | | .set("end_time",null) |
| | | .set("end_reason",null) |
| | | .eq("id",relatedId); |
| | | mapper.update((WorkflowMain) ActionUtil.objeNull,update); |
| | | } |
| | | } |
| | |
| | | public static String time_yyyyMMddHHmmss = "yyyy-MM-dd HH:mm:ss"; |
| | | public static String time_yyyyMMdd = "yyyy-MM-dd"; |
| | | public static String time_yyyyMM = "yyyy-MM"; |
| | | public static String time_yyyy_MM = "yyyy_MM"; |
| | | public static String time_yyyyMMdd_HH_mm_ss = "yyyy-MM-dd_HH_mm_ss"; |
| | | public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | public static SimpleDateFormat sdfwithOutday = new SimpleDateFormat("yyyy_MM"); |
| | |
| | | |
| | | List<String> dateList = new ArrayList<>(); |
| | | LocalDate currentDate = startDate; |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(ActionUtil.time_yyyyMM); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(ActionUtil.time_yyyy_MM); |
| | | while (!currentDate.isAfter(endDate)) { |
| | | String formattedDate = currentDate.format(formatter); |
| | | dateList.add(formattedDate); |
| | |
| | | } |
| | | return dateList; |
| | | } |
| | | // å¹é
"_" åè·ä¸ä¸ªåæ¯ï¼å°åæå¤§åï¼ |
| | | public static String toCamelCase(String input) { |
| | | // å¹é
"_" åè·ä¸ä¸ªåæ¯ï¼å°åæå¤§åï¼ |
| | | Pattern pattern = Pattern.compile("_(\\w)"); |
| | | Matcher matcher = pattern.matcher(input); |
| | | StringBuffer result = new StringBuffer(); |
| | | |
| | | while (matcher.find()) { |
| | | // å°å¹é
å°çåæ¯è½¬ä¸ºå¤§åï¼å¹¶æ¿æ¢æåé¢çä¸å线 |
| | | matcher.appendReplacement(result, matcher.group(1).toUpperCase()); |
| | | } |
| | | matcher.appendTail(result); |
| | | |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) throws ParseException { |
| | | List<String> dateList =getDateListBetweenDates(ActionUtil.sdf.parse("2025-01-01 00:00:00"),new Date()); |
| | | /*List<String> dateList =getDateListBetweenDates(ActionUtil.sdf.parse("2025-01-01 00:00:00"),new Date()); |
| | | for (String date : dateList) { |
| | | System.out.println(date); |
| | | } |
| | | }*/ |
| | | //System.out.println(toCamelCase("user_name_and_age")); |
| | | Date time1=getDateAdd(new Date(),-10); |
| | | System.out.println(ActionUtil.sdf.format(time1)); |
| | | } |
| | | } |
| | |
| | | user = new User(); |
| | | user.setName("unlogged_user"); |
| | | user.setId(0); |
| | | user.setRole(1); |
| | | } |
| | | return user; |
| | | } |
| | |
| | | return timeStr; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param timeFormat |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String format(String timeFormat,Date date) { |
| | | ThreadLocal<SimpleDateFormat> formatThreadLocal = ThreadLocal.withInitial(() -> new SimpleDateFormat(timeFormat)); |
| | | SimpleDateFormat format = formatThreadLocal.get(); |
| | |
| | | order by tb_batt_inf.dev_id asc,battgroup_id asc |
| | | </where> |
| | | </select> |
| | | <select id="getBattAlmParamToExport" resultType="com.whyc.pojo.db_param.BattAlmparam"> |
| | | select distinct tb_batt_almparam.*,tb_batt_inf.battgroup_name,tb_batt_inf.dev_name |
| | | ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_station.tb_batt_inf,db_station.tb_station_inf,db_param.tb_batt_almparam |
| | | <where> |
| | | tb_batt_inf.battgroup_id=tb_batt_almparam.battgroup_id |
| | | and tb_batt_inf.station_id=tb_station_inf.station_id |
| | | <if test="uid>100"> |
| | | and tb_batt_inf.station_id in( |
| | | select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | order by tb_batt_inf.dev_id asc,battgroup_id asc |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <if test="stationId!=null"> |
| | | and tb_station_inf.station_id=#{stationId} |
| | | </if> |
| | | <if test="stationId!=null"> |
| | | and tb_station_inf.station_id=#{stationId} |
| | | </if> |
| | | <if test="battgroupId!=null"> |
| | | and tb_battalarm_data.battgroup_id=#{battgroupId} |
| | | </if> |
| | |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | |
| | | order by alm_start_time desc |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | from db_param.tb_power_property_param,db_pwrdev_alarm.tb_pwrdev_alarm_param_stand |
| | | where tb_power_property_param.property_name=tb_pwrdev_alarm_param_stand.property_name |
| | | and tb_power_property_param.power_type=#{powerType} |
| | | and tb_power_property_param.field_en=1 |
| | | </select> |
| | | </mapper> |
| | |
| | | and bu.uid = #{userId} |
| | | ) |
| | | </select> |
| | | <select id="getPwrtAlmAnalyse" resultType="com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm"> |
| | | select tb_pwrdev_alarm.*,tb_power_inf.power_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_pwrdev_alarm.tb_pwrdev_alarm,db_station.tb_power_inf,db_station.tb_station_inf |
| | | <where> |
| | | tb_pwrdev_alarm.power_id=tb_power_inf.power_id |
| | | and tb_power_inf.station_id=tb_station_inf.station_id |
| | | <if test="provice!=null"> |
| | | and tb_station_inf.provice=#{provice} |
| | | </if> |
| | | <if test="city!=null"> |
| | | and tb_station_inf.city=#{city} |
| | | </if> |
| | | <if test="country!=null"> |
| | | and tb_station_inf.country=#{country} |
| | | </if> |
| | | <if test="stationId!=null"> |
| | | and tb_station_inf.station_id=#{stationId} |
| | | </if> |
| | | <if test="powerId!=null"> |
| | | and tb_pwrdev_alarm.power_id=#{powerId} |
| | | </if> |
| | | <if test="uid>100"> |
| | | and tb_pwrdev_alarm.power_id in( |
| | | select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | </where> |
| | | order by alm_start_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | order by tb_power_inf.power_id asc |
| | | </where> |
| | | </select> |
| | | <select id="getPwrAlmParamToExport" resultType="com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarmParam"> |
| | | select distinct tb_pwrdev_alarm_param.*,tb_power_inf.power_name |
| | | ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name |
| | | from db_station.tb_power_inf,db_station.tb_station_inf,db_pwrdev_alarm.tb_pwrdev_alarm_param |
| | | <where> |
| | | tb_power_inf.power_id=tb_pwrdev_alarm_param.power_id |
| | | and tb_power_inf.station_id=tb_station_inf.station_id |
| | | <if test="uid>100"> |
| | | and tb_power_inf.power_id in( |
| | | select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr |
| | | where tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id |
| | | and tb_baojigroup_usr.uid=#{uid} |
| | | ) |
| | | </if> |
| | | order by tb_power_inf.power_id asc |
| | | </where> |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.WorkflowLinkMapper"> |
| | | <resultMap id="linkMain" type="WorkflowLink"> |
| | | <result column="lid" property="id"></result> |
| | | <result column="lmain_id" property="mainId"></result> |
| | | <result column="parent_id" property="parentId"></result> |
| | | <result column="lprocess_level" property="processLevel"></result> |
| | | <result column="process_level_name" property="processLevelName"></result> |
| | | <result column="lcreate_time" property="createTime"></result> |
| | | <result column="deal_user_id" property="dealUserId"></result> |
| | | <result column="deal_type" property="dealType"></result> |
| | | <result column="deal_desc" property="dealDesc"></result> |
| | | <result column="deal_file_name" property="dealFileName"></result> |
| | | <result column="deal_file_url" property="dealFileUrl"></result> |
| | | <result column="deal_pic_name" property="dealPicName"></result> |
| | | <result column="deal_pic_url" property="dealPicUrl"></result> |
| | | <result column="lstatus" property="status"></result> |
| | | <result column="deal_role_id" property="dealRoleId"></result> |
| | | <result column="deal_and_close" property="dealAndClose"></result> |
| | | <result column="deal_reject_reason" property="dealRejectReason"></result> |
| | | <result column="deal_task_num" property="dealTaskNum"></result> |
| | | <result column="deal_task_reply_num" property="dealTaskReplyNum"></result> |
| | | <result column="deal_reason" property="dealReason"></result> |
| | | <result column="required_finish_time" property="requiredFinishTime"></result> |
| | | <result column="deal_time" property="dealTime"></result> |
| | | <result column="reply_content" property="replyContent"></result> |
| | | <result column="reply_time" property="replyTime"></result> |
| | | <association property="workflowMain" javaType="WorkflowMain"> |
| | | <result column="mid" property="id"></result> |
| | | <result column="order_id" property="orderId"></result> |
| | | <result column="title" property="title"></result> |
| | | <result column="task_desc" property="taskDesc"></result> |
| | | <result column="create_user_id" property="createUserId"></result> |
| | | <result column="mcreate_time" property="createTime"></result> |
| | | <result column="plan_begin_time" property="planBeginTime"></result> |
| | | <result column="plan_end_time" property="planEndTime"></result> |
| | | <result column="begin_time" property="beginTime"></result> |
| | | <result column="end_time" property="endTime"></result> |
| | | <result column="task_level" property="taskLevel"></result> |
| | | <result column="is_in_time" property="inTime"></result> |
| | | <result column="mstatus" property="status"></result> |
| | | <result column="mprocess_level" property="processLevel"></result> |
| | | <result column="file_name" property="fileName"></result> |
| | | <result column="file_url" property="fileUrl"></result> |
| | | <result column="pic_name" property="picName"></result> |
| | | <result column="pic_url" property="picUrl"></result> |
| | | <result column="end_reason" property="endReason"></result> |
| | | <result column="is_auto" property="auto"></result> |
| | | <result column="type" property="type"></result> |
| | | </association> |
| | | </resultMap> |
| | | <select id="getReceivedList" resultType="com.whyc.pojo.web_site.WorkflowLink"> |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | ) |
| | | </select> |
| | | |
| | | <select id="getReceivedList2" resultType="com.whyc.pojo.web_site.WorkflowLink"> |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | <choose> |
| | | <when test="type == 0"> |
| | | and m.type in (2,3) |
| | | </when> |
| | | <otherwise> |
| | | and m.type = #{type} |
| | | </otherwise> |
| | | </choose> |
| | | and l.deal_user_id = #{user.uId} |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT l.* |
| | | FROM web_site.tb_workflow_main m, |
| | | web_site.tb_workflow_link l |
| | | where m.id = l.main_id |
| | | <choose> |
| | | <when test="type == 0"> |
| | | and m.type in (2,3) |
| | | </when> |
| | | <otherwise> |
| | | and m.type = #{type} |
| | | </otherwise> |
| | | </choose> |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | ) |
| | | </select> |
| | | |
| | | <select id="searchTmp" resultMap="linkMain"> |
| | | ( |
| | | SELECT parent_id |
| | | , process_level_name |
| | | , deal_user_id |
| | | , deal_type |
| | | , deal_desc |
| | | , deal_file_name |
| | | , deal_file_url |
| | | , deal_pic_name |
| | | , deal_pic_url |
| | | , deal_role_id |
| | | , deal_and_close |
| | | , deal_reject_reason |
| | | , deal_task_num |
| | | , deal_task_reply_num |
| | | , deal_reason |
| | | , required_finish_time |
| | | , deal_time |
| | | , reply_content |
| | | , reply_time |
| | | , l.process_level as lprocess_level |
| | | , l.main_id as lmain_id |
| | | , l.id as lid |
| | | , l.status as lstatus |
| | | , l.create_time as lcreate_time |
| | | , order_id |
| | | , title |
| | | , task_desc |
| | | , create_user_id |
| | | , plan_begin_time |
| | | , plan_end_time |
| | | , begin_time |
| | | , end_time |
| | | , task_level |
| | | , is_in_time |
| | | , file_name |
| | | , file_url |
| | | , pic_name |
| | | , pic_url |
| | | , end_reason |
| | | , is_auto |
| | | , m.type |
| | | , m.id as mid |
| | | , m.process_level as mprocess_level |
| | | , m.status as mstatus |
| | | , m.create_time as mcreate_time |
| | | FROM web_site.tb_workflow_link l |
| | | LEFT OUTER JOIN web_site.tb_workflow_main m on m.id = l.main_id |
| | | <where> |
| | | l.deal_user_id = #{uId} |
| | | <if test="type!=0"> |
| | | and m.type = #{type} |
| | | </if> |
| | | <if test="type==0"> |
| | | and m.type != 1 |
| | | </if> |
| | | <if test="status==1"> |
| | | and m.status = #{status} |
| | | and l.status in (0,1,6) |
| | | </if> |
| | | <if test="status==2"> |
| | | and l.status =5 |
| | | </if> |
| | | <if test="status==3"> |
| | | and m.status = #{status} |
| | | and l.status =8 |
| | | </if> |
| | | </where> |
| | | |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT parent_id |
| | | , process_level_name |
| | | , deal_user_id |
| | | , deal_type |
| | | , deal_desc |
| | | , deal_file_name |
| | | , deal_file_url |
| | | , deal_pic_name |
| | | , deal_pic_url |
| | | , deal_role_id |
| | | , deal_and_close |
| | | , deal_reject_reason |
| | | , deal_task_num |
| | | , deal_task_reply_num |
| | | , deal_reason |
| | | , required_finish_time |
| | | , deal_time |
| | | , reply_content |
| | | , reply_time |
| | | , l.process_level as lprocess_level |
| | | , l.main_id as lmain_id |
| | | , l.id as lid |
| | | , l.status as lstatus |
| | | , l.create_time as lcreate_time |
| | | , order_id |
| | | , title |
| | | , task_desc |
| | | , create_user_id |
| | | , plan_begin_time |
| | | , plan_end_time |
| | | , begin_time |
| | | , end_time |
| | | , task_level |
| | | , is_in_time |
| | | , file_name |
| | | , file_url |
| | | , pic_name |
| | | , pic_url |
| | | , end_reason |
| | | , is_auto |
| | | , m.type |
| | | , m.id as mid |
| | | , m.process_level as mprocess_level |
| | | , m.status as mstatus |
| | | , m.create_time as mcreate_time |
| | | FROM web_site.tb_workflow_link l |
| | | LEFT OUTER JOIN web_site.tb_workflow_main m on m.id = l.main_id |
| | | <where> |
| | | l.deal_role_id = #{uRole} |
| | | and l.deal_user_id is null |
| | | <if test="type!=0"> |
| | | and m.type = #{type} |
| | | </if> |
| | | <if test="type==0"> |
| | | and m.type != 1 |
| | | </if> |
| | | <if test="status==1"> |
| | | and m.status = #{status} |
| | | and l.status in (0,1,6) |
| | | </if> |
| | | <if test="status==2"> |
| | | and l.status =5 |
| | | </if> |
| | | <if test="status==3"> |
| | | and m.status = #{status} |
| | | and l.status =8 |
| | | </if> |
| | | </where> |
| | | ) |
| | | ORDER BY lid |
| | | </select> |
| | | <resultMap id="Mainlink" type="WorkflowMain"> |
| | | <result column="id" property="id"></result> |
| | | <result column="order_id" property="orderId"></result> |
| | | <result column="title" property="title"></result> |
| | | <result column="task_desc" property="taskDesc"></result> |
| | | <result column="create_user_id" property="createUserId"></result> |
| | | <result column="create_time" property="createTime"></result> |
| | | <result column="plan_begin_time" property="planBeginTime"></result> |
| | | <result column="plan_end_time" property="planEndTime"></result> |
| | | <result column="begin_time" property="beginTime"></result> |
| | | <result column="end_time" property="endTime"></result> |
| | | <result column="task_level" property="taskLevel"></result> |
| | | <result column="is_in_time" property="inTime"></result> |
| | | <result column="status" property="status"></result> |
| | | <result column="file_name" property="fileName"></result> |
| | | <result column="file_url" property="fileUrl"></result> |
| | | <result column="pic_name" property="picName"></result> |
| | | <result column="pic_url" property="picUrl"></result> |
| | | <result column="end_reason" property="endReason"></result> |
| | | <result column="is_auto" property="auto"></result> |
| | | <result column="type" property="type"></result> |
| | | <result column="process_level" property="processLevel"></result> |
| | | <collection property="workflowLink" javaType="WorkflowLink" ofType="com.whyc.pojo.WorkflowLink" |
| | | column="{main_id=id}" select="selectWorkflowLink"> |
| | | </collection> |
| | | </resultMap> |
| | | <select id="getFlowMainByUid" resultMap="Mainlink"> |
| | | SELECT |
| | | id |
| | | ,order_id |
| | | , title |
| | | , task_desc |
| | | , create_user_id |
| | | , plan_begin_time |
| | | , plan_end_time |
| | | , begin_time |
| | | , end_time |
| | | , task_level |
| | | , is_in_time |
| | | , file_name |
| | | , file_url |
| | | , pic_name |
| | | , pic_url |
| | | , end_reason |
| | | , is_auto |
| | | , type |
| | | ,status |
| | | , create_time |
| | | ,process_level |
| | | FROM web_site.tb_workflow_main m |
| | | <where> |
| | | m.create_user_id=#{userId} |
| | | <if test="type!=0"> |
| | | and m.type = #{type} |
| | | </if> |
| | | <if test="type==0"> |
| | | and m.type != 1 |
| | | </if> |
| | | <if test="status!=0"> |
| | | and m.status = #{status} |
| | | </if> |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="selectWorkflowLink" resultType="workflowLink"> |
| | | SELECT * |
| | | from web_site.tb_workflow_link |
| | | where main_id = #{main_id} |
| | | order by parent_id desc limit 1 |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.WorkflowMainMapper" > |
| | | |
| | | <sql id="linkColumn"> |
| | | l.id link_id, |
| | | l.main_id, |
| | | l.parent_id, |
| | | l.process_level as lProcessLevel, |
| | | l.process_level_name, |
| | | l.create_time link_create_time, |
| | | l.deal_user_id, |
| | | l.deal_type, |
| | | l.deal_desc, |
| | | l.deal_file_name, |
| | | l.deal_file_url, |
| | | l.deal_pic_name, |
| | | l.deal_pic_url, |
| | | l.status link_status, |
| | | l.deal_role_id, |
| | | l.deal_and_close, |
| | | l.deal_reject_reason, |
| | | l.deal_task_num, |
| | | l.deal_task_reply_num, |
| | | l.deal_reason, |
| | | l.required_finish_time, |
| | | l.deal_time, |
| | | l.reply_content, |
| | | l.reply_time |
| | | </sql> |
| | | |
| | | <resultMap id="Map_WorkflowMain" type="WorkflowMain"> |
| | | <id column="id" property="id"/> |
| | | <result column="title" property="title"/> |
| | | <result column="order_id" property="orderId"/> |
| | | <result column="task_desc" property="taskDesc"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="create_user_id" property="createUserId"/> |
| | | <result column="create_user_name" property="createUserName"/> |
| | | <result column="plan_begin_time" property="planBeginTime"/> |
| | | <result column="plan_end_time" property="planEndTime"/> |
| | | <result column="begin_time" property="beginTime"/> |
| | | <result column="end_time" property="endTime"/> |
| | | <result column="task_level" property="taskLevel"/> |
| | | <result column="is_in_time" property="inTime"/> |
| | | <result column="file_name" property="fileName"/> |
| | | <result column="file_url" property="fileUrl"/> |
| | | <result column="pic_name" property="picName"/> |
| | | <result column="pic_url" property="picUrl"/> |
| | | <result column="end_reason" property="endReason"/> |
| | | <result column="status" property="status"/> |
| | | <result column="is_auto" property="auto"/> |
| | | <result column="type" property="type"/> |
| | | <collection property="linkList" ofType="WorkflowLink"> |
| | | <id column="link_id" property="id"/> |
| | | <result column="main_id" property="mainId"/> |
| | | <result column="parent_id" property="parentId"/> |
| | | <result column="lProcessLevel" property="processLevel"/> |
| | | <result column="process_level_name" property="processLevelName"/> |
| | | <result column="link_create_time" property="createTime"/> |
| | | <result column="deal_user_id" property="dealUserId"/> |
| | | <result column="deal_type" property="dealType"/> |
| | | <result column="deal_desc" property="dealDesc"/> |
| | | <result column="deal_file_name" property="dealFileName"/> |
| | | <result column="deal_file_url" property="dealFileUrl"/> |
| | | <result column="deal_pic_name" property="dealPicName"/> |
| | | <result column="deal_pic_url" property="dealPicUrl"/> |
| | | <result column="link_status" property="status"/> |
| | | <result column="deal_role_id" property="dealRoleId"/> |
| | | <result column="deal_and_close" property="dealAndClose"/> |
| | | <result column="deal_reject_reason" property="dealRejectReason"/> |
| | | <result column="deal_task_num" property="dealTaskNum"/> |
| | | <result column="deal_task_reply_num" property="dealTaskReplyNum"/> |
| | | <result column="deal_reason" property="dealReason"/> |
| | | <result column="deal_time" property="dealTime"/> |
| | | <result column="required_finish_time" property="requiredFinishTime"/> |
| | | <result column="reply_content" property="replyContent"/> |
| | | <result column="reply_time" property="replyTime"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <select id="getReceivedListByUserAndType" resultMap="Map_WorkflowMain"> |
| | | <choose> |
| | | <!--å
¨é¨--> |
| | | <when test="status==0"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | union all |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} order by id desc |
| | | </when> |
| | | <!--å¾
æ¥å--> |
| | | <when test="status==1"> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_role_id = #{user.uRole} |
| | | and l.deal_user_id is null |
| | | and l.status = #{status} order by m.id desc |
| | | </when> |
| | | <otherwise> |
| | | SELECT m.*,u.uName as create_user_name,<include refid="linkColumn" /> |
| | | FROM web_site.tb_workflow_main m,web_site.tb_workflow_link l,db_user.tb_user_inf u |
| | | where m.id = l.main_id |
| | | and m.create_user_id = u.uId |
| | | and m.type = #{type} |
| | | and l.deal_user_id = #{user.uId} |
| | | and l.status = #{status} order by m.id desc |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </select> |
| | | <select id="getMaxId" resultType="java.lang.Integer"> |
| | | select max(id) |
| | | from web_site.tb_workflow_main |
| | | </select> |
| | | </mapper> |