Merge remote-tracking branch 'origin/master'
| | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonButtonConfig; |
| | | import org.jeecg.modules.andon.service.IAndonButtonConfigService; |
| | | import org.jeecg.modules.andon.service.impl.AndonOrderServiceImpl; |
| | |
| | | */ |
| | | @ApiOperation(value = "å®ç¯åèµ·-å页å表æ¥è¯¢", notes = "å®ç¯åèµ·-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/queryUserAndonCallList") |
| | | public Result<List<AndonButtonDTO>> queryUserAndonCallList(@RequestParam("factoryId") String factoryId) { |
| | | List<AndonButtonDTO> list = andonButtonConfigService.queryUserAndonCallList(factoryId); |
| | | public Result<List<AndonOrdeDto>> queryUserAndonCallList(@RequestParam("factoryId") String factoryId, @RequestParam("orderStatus") String orderStatus) { |
| | | List<AndonOrdeDto> list = andonButtonConfigService.queryUserAndonCallList(factoryId,orderStatus); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(value = "å®ç¯ååº-å页å表æ¥è¯¢", notes = "å®ç¯ååº-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/queryUserAndonRespondList") |
| | | public Result<List<AndonButtonDTO>> queryUserAndonRespondList(@RequestParam("factoryId") String factoryId) { |
| | | List<AndonButtonDTO> list = andonButtonConfigService.queryUserAndonRespondList(factoryId); |
| | | public Result<List<AndonOrdeDto>> queryUserAndonRespondList(@RequestParam("factoryId") String factoryId, @RequestParam("orderStatus") String orderStatus) { |
| | | List<AndonOrdeDto> list = andonButtonConfigService.queryUserAndonRespondList(factoryId,orderStatus); |
| | | return Result.OK(list); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation(value = "å®ç¯ååº-å页å表æ¥è¯¢", notes = "å®ç¯ååº-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/queryUserAndonHandelList") |
| | | public Result<List<AndonButtonDTO>> queryUserAndonHandelList(@RequestParam("factoryId") String factoryId) { |
| | | List<AndonButtonDTO> list = andonButtonConfigService.queryUserAndonHandelList(factoryId); |
| | | public Result<List<AndonOrdeDto>> queryUserAndonHandelList(@RequestParam("factoryId") String factoryId ,@RequestParam("orderStatus") String orderStatus) { |
| | | List<AndonOrdeDto> list = andonButtonConfigService.queryUserAndonHandelList(factoryId,orderStatus); |
| | | return Result.OK(list); |
| | | } |
| | | /** |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonOrder; |
| | | import org.jeecg.modules.andon.service.IAndonOrderService; |
| | | import org.jeecg.modules.andon.service.IAndonResponseConfigService; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.sql.Date; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | |
| | | private IAndonOrderService andonOrderService; |
| | | |
| | | |
| | | @Autowired |
| | | private IAndonResponseConfigService andonResponseConfigService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | |
| | | @ApiOperation(value = "å®ç¯å·¥å-æ·»å ", notes = "å®ç¯å·¥å-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody AndonOrder andonOrder) { |
| | | // æ ¹æ®button_idæ¥è¯¢å¯¹åºç产线ID |
| | | if (andonOrder.getButtonId() != null) { |
| | | String productionLineId = andonResponseConfigService.getProductionLineIdByButtonId(andonOrder.getButtonId()); |
| | | if (productionLineId != null) { |
| | | andonOrder.setFactoryId(productionLineId); |
| | | } |
| | | } |
| | | andonOrderService.save(andonOrder); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param andonOrder |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "å®ç¯APPå·¥å-æ·»å ") |
| | | @ApiOperation(value = "å®ç¯APPå·¥å-æ·»å ", notes = "å®ç¯APPå·¥å-æ·»å ") |
| | | @PostMapping(value = "/app/add") |
| | | public Result<String> appAdd(@RequestBody AndonOrder andonOrder) { |
| | | // æ ¹æ®button_idæ¥è¯¢å¯¹åºç产线ID |
| | | andonOrder.setAndonLevel("1"); |
| | | andonOrder.setFactoryId(andonOrder.getFactoryId()); |
| | | andonOrder.setOperator(andonOrder.getOperator()); |
| | | String Responder = andonResponseConfigService.getResponderByButtonId(andonOrder.getButtonId(),andonOrder.getFactoryId()); |
| | | andonOrder.setResponder(Responder); |
| | | andonOrder.setProcessor(Responder); |
| | | andonOrder.setOperateTime(new java.sql.Timestamp(System.currentTimeMillis())); |
| | | andonOrderService.save(andonOrder); |
| | | // å建AndonOrderDto对象并å¤å¶å±æ§ |
| | | AndonOrdeDto andonOrderDto = new AndonOrdeDto(); |
| | | // å¤å¶å¿
è¦å±æ§å°Dto对象 |
| | | andonOrderDto.setId(andonOrder.getId()); |
| | | andonOrderDto.setButtonId(andonOrder.getButtonId()); |
| | | andonOrderDto.setFactoryId(andonOrder.getFactoryId()); |
| | | andonOrderDto.setOperator(andonOrder.getOperator()); |
| | | andonOrderDto.setResponder(andonOrder.getResponder()); |
| | | andonOrderDto.setProcessor(andonOrder.getProcessor()); |
| | | andonOrderDto.setAndonLevel(andonOrder.getAndonLevel()); |
| | | andonOrderDto.setOperateTime(andonOrder.getOperateTime()); |
| | | andonResponseConfigService.sendAndonNotification(andonOrderDto); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * APPå®ç¯ååºæä½ |
| | | * |
| | | * @param orderId |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "APPå®ç¯ååºæä½", notes = "APPå®ç¯ååºæä½") |
| | | @GetMapping(value = "/AndonRespond") |
| | | public Result<String> AndonRespond(@RequestParam("orderId") String orderId) { |
| | | AndonOrder andonOrder = andonOrderService.getById(orderId); |
| | | public Result<String> AndonRespond(@RequestParam("id") String id) { |
| | | AndonOrder andonOrder = andonOrderService.getById(id); |
| | | andonOrder.setOrderStatus("2"); |
| | | andonOrderService.updateById(andonOrder); |
| | | return Result.OK("ååºæåï¼"); |
| | |
| | | |
| | | /** |
| | | * APPå®ç¯å¤çæä½ |
| | | * |
| | | * |
| | | * @return |
| | | */ |
| | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonResponseConfig; |
| | | import org.jeecg.modules.andon.service.IAndonResponseConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @AutoLog(value = "å®ç¯å·¥å-åéé£ä¹¦æ¶æ¯") |
| | | @ApiOperation(value = "å®ç¯å·¥å-åéé£ä¹¦æ¶æ¯", notes = "å®ç¯å·¥å-åéé£ä¹¦æ¶æ¯") |
| | | @PostMapping(value = "/sendMessage") |
| | | public Result<String> sendMessage(@RequestBody AndonButtonDTO andonButtonDTO) { |
| | | public Result<String> sendMessage(@RequestBody AndonOrdeDto andonButtonDTO) { |
| | | try { |
| | | andonButtonDTO.setBlinkingFlag(1); |
| | | // è°ç¨æå¡å±å¤çä¸å¡é»è¾ |
| | | andonResponseConfigService.sendAndonNotification(andonButtonDTO); |
| | | return Result.OK("æ·»å æåï¼"); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.andon.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.jeecg.common.aspect.annotation.Dict; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | public class AndonOrdeDto { |
| | | /**主é®*/ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | @ApiModelProperty(value = "主é®") |
| | | private String id; |
| | | /**å建人*/ |
| | | @ApiModelProperty(value = "å建人") |
| | | private String createBy; |
| | | /**åå»ºæ¥æ*/ |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "åå»ºæ¥æ") |
| | | private Date createTime; |
| | | /**æ´æ°äºº*/ |
| | | @ApiModelProperty(value = "æ´æ°äºº") |
| | | private String updateBy; |
| | | /**æ´æ°æ¥æ*/ |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | private Date updateTime; |
| | | /**å 餿 è®°*/ |
| | | |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | /**产线ID*/ |
| | | |
| | | @ApiModelProperty(value = "产线ID") |
| | | @Dict(dictTable = "base_factory", dicCode = "id", dicText = "factory_name") |
| | | private String factoryId; |
| | | /**å®ç¯ç±»å*/ |
| | | |
| | | @ApiModelProperty(value = "å®ç¯ç±»å") |
| | | @Dict(dictTable = "andon_button_config", dicCode = "id", dicText = "button_name") |
| | | private String buttonId; |
| | | /**å®ç¯äºº*/ |
| | | |
| | | @Dict(dictTable = "sys_user", dicCode = "id", dicText = "username") |
| | | @ApiModelProperty(value = "å®ç¯äºº") |
| | | private String operator; |
| | | /**å®ç¯æ¶é´*/ |
| | | |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "å®ç¯æ¶é´") |
| | | private Date operateTime; |
| | | /**å®ç¯ç级*/ |
| | | |
| | | @Dict(dicCode = "andon_level") |
| | | @ApiModelProperty(value = "å®ç¯ç级") |
| | | private String andonLevel; |
| | | /**ååºäºº*/ |
| | | @Dict(dictTable = "sys_user", dicCode = "id", dicText = "username") |
| | | |
| | | @ApiModelProperty(value = "ååºäºº") |
| | | private String responder; |
| | | /**ååºæ¶é´*/ |
| | | |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "ååºæ¶é´") |
| | | private Date responseTime; |
| | | /**å¤ç人*/ |
| | | @Dict(dictTable = "sys_user", dicCode = "id", dicText = "username") |
| | | |
| | | @ApiModelProperty(value = "å¤ç人") |
| | | private String processor; |
| | | /**å¤ç宿æ¶é´*/ |
| | | |
| | | @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | @ApiModelProperty(value = "å¤ç宿æ¶é´") |
| | | private Date processTime; |
| | | /**å®ç¯ç¶æ*/ |
| | | |
| | | @Dict(dicCode = "order_status") |
| | | @ApiModelProperty(value = "å®ç¯ç¶æ") |
| | | private String orderStatus; |
| | | /**é®é¢æè¿°*/ |
| | | |
| | | @ApiModelProperty(value = "é®é¢æè¿°") |
| | | private String problemDescreption; |
| | | /**å¤çç»ææè¿°*/ |
| | | |
| | | @ApiModelProperty(value = "å¤çç»ææè¿°") |
| | | private String resolutionDescreption; |
| | | @ApiModelProperty(value = "ä¸çº§ååºäººopenId") |
| | | private String responderOpenId; |
| | | |
| | | @ApiModelProperty(value = "äºçº§ååºäººopenId") |
| | | private String secondResponderOpenId; |
| | | |
| | | @ApiModelProperty(value = "ä¸çº§ååºäººopenId") |
| | | private String thirdResponderOpenId; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "ä¸çº§ååºäºº") |
| | | private String thirdResponder; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "äºçº§ååºäºº") |
| | | private String secondResponder; |
| | | /**产线åç§°*/ |
| | | @ApiModelProperty(value = "产线åç§°") |
| | | private String factoryName; |
| | | |
| | | /**产线åç§°*/ |
| | | @ApiModelProperty(value = "å·¥ååç§°") |
| | | private String parentFactoryName; |
| | | |
| | | /**ä¸çº§ååºæ¶é¿*/ |
| | | @ApiModelProperty(value = "ä¸çº§ååºæ¶é¿") |
| | | private Integer upgradeResponseDuration; |
| | | |
| | | |
| | | /**æé®åç§°*/ |
| | | @ApiModelProperty(value = "æé®åç§°") |
| | | private String buttonName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * å®ç¯äººåç§° |
| | | */ |
| | | @ApiModelProperty(value = "å®ç¯äººåç§°") |
| | | private String operatorName; |
| | | |
| | | /**äºçº§ååºæ¶é¿*/ |
| | | @ApiModelProperty(value = "äºçº§ååºæ¶é¿") |
| | | private Integer secondUpgradeResponseDuration; |
| | | |
| | | /**ä¸çº§çº§ååºæ¶é¿*/ |
| | | @ApiModelProperty(value = "ä¸çº§ååºæ¶é¿") |
| | | private Integer thirdUpgradeResponseDuration; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonButtonConfig; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<AndonButtonDTO> queryUserAndonCallList(String factoryId); |
| | | List<AndonOrdeDto> queryUserAndonCallList(String factoryId, String orderStatus); |
| | | |
| | | /** |
| | | * ååºå®ç¯å表 |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<AndonButtonDTO> queryUserAndonRespondList(String factoryId); |
| | | |
| | | List<AndonOrdeDto> queryUserAndonRespondList(String factoryId, String orderStatus); |
| | | |
| | | /** |
| | | * å¤çå®ç¯å表 |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<AndonButtonDTO> queryUserAndonHandelList(String factoryId); |
| | | List<AndonOrdeDto> queryUserAndonHandelList(String factoryId, String orderStatus); |
| | | |
| | | } |
| | | |
| | |
| | | where arc.factory_id=#{factoryId}; |
| | | </select> |
| | | |
| | | <select id="queryUserAndonCallList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO"> |
| | | select arc.id, |
| | | abc.id as buttonId, |
| | | abc.button_name as buttonName, |
| | | abc.button_code as buttonCode, |
| | | (select count(1) |
| | | from andon_order ao |
| | | where ao.button_id = arc.button_id |
| | | and ao.factory_id = arc.factory_id |
| | | and ao.order_status = '1') as blinkingFlag, |
| | | STUFF((SELECT ',' + CAST (ao.id AS VARCHAR) |
| | | FROM andon_order ao |
| | | WHERE ao.button_id = arc.button_id |
| | | and ao.factory_id = arc.factory_id |
| | | and ao.order_status = '1' |
| | | FOR XML PATH ('')), 1, 1, '') as orderIds, |
| | | bf.factory_name as factoryName, |
| | | parent_bf.factory_name as parentFactoryName, |
| | | abc.upgrade_response_duration as upgradeResponseDuration, |
| | | abc.second_upgrade_response_duration as secondUpgradeResponseDuration, |
| | | arc.firster_responder as responder, |
| | | arc.second_responder, |
| | | arc.third_responder, |
| | | STUFF((SELECT ',' + ao.order_status |
| | | FROM andon_order ao |
| | | WHERE ao.button_id = arc.button_id |
| | | and ao.factory_id = arc.factory_id |
| | | and ao.order_status = '1' |
| | | FOR XML PATH ('')), 1, 1, '') as orderStatus |
| | | from andon_response_config arc |
| | | left join andon_button_config abc |
| | | on arc.button_id = abc.id |
| | | left join base_factory bf on arc.factory_id = bf.id |
| | | left join base_factory parent_bf on bf.parent_id = parent_bf.id |
| | | where arc.factory_id=#{factoryId} |
| | | and (select count (1) |
| | | from andon_order ao |
| | | where ao.button_id = arc.button_id |
| | | and ao.factory_id = arc.factory_id |
| | | and ao.order_status = '1') = 1 |
| | | <select id="queryUserAndonCallList" resultType="org.jeecg.modules.andon.dto.AndonOrdeDto"> |
| | | SELECT |
| | | ao.*, |
| | | bf.factory_name as factoryName, |
| | | parent_bf.factory_name as parentFactoryName, |
| | | abc.button_name as buttonName, |
| | | abc.upgrade_response_duration as upgradeResponseDuration, |
| | | abc.second_upgrade_response_duration as secondUpgradeResponseDuration, |
| | | su.username as operatorName |
| | | FROM andon_order ao |
| | | LEFT JOIN base_factory bf ON ao.factory_id = bf.id |
| | | LEFT JOIN base_factory parent_bf ON bf.parent_id = parent_bf.id |
| | | LEFT JOIN andon_button_config abc ON ao.button_id = abc.id |
| | | LEFT JOIN sys_user su ON ao.operator = su.id |
| | | WHERE ao.factory_id = #{factoryId} |
| | | AND ao.del_flag = 0 |
| | | AND ao.order_status = #{orderStatus} |
| | | </select> |
| | | |
| | | <select id="queryUserAndonRespondList" resultType="org.jeecg.modules.andon.dto.AndonButtonDTO"> |
| | | <select id="queryUserAndonRespondList" resultType="org.jeecg.modules.andon.dto.AndonOrdeDto"> |
| | | select arc.id, |
| | | abc.id as buttonId, |
| | | abc.button_name as buttonName, |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonButtonConfig; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<AndonButtonDTO> queryUserAndonCallList(String factoryId); |
| | | List<AndonOrdeDto> queryUserAndonCallList(String factoryId, String orderStatus); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·åèµ·å®ç¯ååºå表 |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<AndonButtonDTO> queryUserAndonRespondList(String factoryId); |
| | | |
| | | List<AndonOrdeDto> queryUserAndonRespondList(String factoryId,String orderStatus); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·åèµ·å®ç¯å¤çå表 |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<AndonButtonDTO> queryUserAndonHandelList(String factoryId); |
| | | List<AndonOrdeDto> queryUserAndonHandelList(String factoryId,String orderStatus); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonOrder; |
| | | import org.jeecg.modules.andon.entity.AndonResponseConfig; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®button_idè·å产线ID |
| | | * @param buttonId |
| | | * @return |
| | | */ |
| | | String getProductionLineIdByButtonId(String buttonId); |
| | | |
| | | /** |
| | | * æ ¹æ®button_idè·åååºäºº |
| | | * @param buttonId |
| | | * @return |
| | | */ |
| | | String getResponderByButtonId(String buttonId,String factoryId); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®button_idåfactory_idè·åååºé
置对象 |
| | | * @param buttonId æé®ID |
| | | * @param factoryId å·¥å/产线ID |
| | | * @return AndonResponseConfig ååºé
置对象 |
| | | */ |
| | | AndonResponseConfig getResponseConfigByButtonIdAndFactoryId(String buttonId, String factoryId); |
| | | |
| | | |
| | | /** |
| | | * åéå®ç¯éç¥ |
| | | * @param andonButtonDTO å®ç¯æé®DTO |
| | | * @return ç»æ |
| | | */ |
| | | void sendAndonNotification(AndonButtonDTO andonButtonDTO); |
| | | void sendAndonNotification(AndonOrdeDto andonButtonDTO); |
| | | } |
| | |
| | | package org.jeecg.modules.andon.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.pro.packaged.S; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonButtonConfig; |
| | | import org.jeecg.modules.andon.mapper.AndonButtonConfigMapper; |
| | | import org.jeecg.modules.andon.service.IAndonButtonConfigService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<AndonButtonDTO> queryUserAndonCallList(String factoryId) { |
| | | return baseMapper.queryUserAndonCallList(factoryId); |
| | | public List<AndonOrdeDto> queryUserAndonCallList(String factoryId, String orderStatus) { |
| | | return baseMapper.queryUserAndonCallList(factoryId, orderStatus); |
| | | } |
| | | |
| | | @Override |
| | | public List<AndonButtonDTO> queryUserAndonRespondList(String factoryId) { |
| | | return baseMapper.queryUserAndonRespondList(factoryId); |
| | | public List<AndonOrdeDto> queryUserAndonRespondList(String factoryId, String orderStatus) { |
| | | return baseMapper.queryUserAndonRespondList(factoryId, orderStatus); |
| | | } |
| | | |
| | | @Override |
| | | public List<AndonButtonDTO> queryUserAndonHandelList(String factoryId) { |
| | | return baseMapper.queryUserAndonHandelList(factoryId); |
| | | public List<AndonOrdeDto> queryUserAndonHandelList(String factoryId, String orderStatus) { |
| | | return baseMapper.queryUserAndonHandelList(factoryId, orderStatus); |
| | | } |
| | | |
| | | |
| | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.andon.entity.AndonButtonConfig; |
| | | import org.jeecg.modules.andon.entity.AndonOrder; |
| | | import org.jeecg.modules.andon.entity.AndonResponseConfig; |
| | |
| | | return baseMapper.getAndonResponseConfigByFactoryIdAndButtonId(factoryId, buttonId); |
| | | } |
| | | |
| | | @Override |
| | | public String getProductionLineIdByButtonId(String buttonId) { |
| | | QueryWrapper<AndonResponseConfig> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("button_id", buttonId); |
| | | AndonResponseConfig config = this.getOne(queryWrapper); |
| | | return config != null ? config.getFactoryId() : null; |
| | | } |
| | | |
| | | @Override |
| | | public String getResponderByButtonId(String buttonId,String factoryId) { |
| | | QueryWrapper<AndonResponseConfig> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("button_id", buttonId); |
| | | queryWrapper.eq("factory_id", factoryId); // å设factory_id对åºäº§çº¿ID |
| | | AndonResponseConfig config = this.getOne(queryWrapper, false); |
| | | return config != null ? config.getFirsterResponder() : null; |
| | | } |
| | | |
| | | @Override |
| | | public AndonResponseConfig getResponseConfigByButtonIdAndFactoryId(String buttonId, String factoryId) { |
| | | QueryWrapper<AndonResponseConfig> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("button_id", buttonId); |
| | | queryWrapper.eq("factory_id", factoryId); |
| | | // 使ç¨falseåæ°ï¼å½æ¥è¯¢å°å¤æ¡è®°å½æ¶ä¸ä¼æåºå¼å¸¸ï¼èæ¯è¿åç¬¬ä¸æ¡ |
| | | return this.getOne(queryWrapper, false); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void sendAndonNotification(AndonButtonDTO andonButtonDTO) { |
| | | public void sendAndonNotification(AndonOrdeDto andonButtonDTO) { |
| | | /** |
| | | * 1. éªè¯å·¥åç¶æ |
| | | */ |
| | |
| | | log.warn("请æ±åæ°ä¸ºç©º"); |
| | | throw new IllegalArgumentException("请æ±åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | /** |
| | | * 设置å®ç¯äºº |
| | | */ |
| | | |
| | | /** |
| | | * 2. è·åååºé
ç½® |
| | | */ |
| | | AndonResponseConfig andonResponseConfig = this.getById(andonButtonDTO.getId()); |
| | | AndonResponseConfig andonResponseConfig = getResponseConfigByButtonIdAndFactoryId(andonButtonDTO.getButtonId(), andonButtonDTO.getFactoryId()); |
| | | |
| | | AndonOrder andonOrder = andonOrderService.getById(andonButtonDTO.getOrderIds()); |
| | | AndonOrder andonOrder = andonOrderService.getById(andonButtonDTO.getId()); |
| | | if (andonOrder == null) { |
| | | log.warn("æªæ¾å°ID为[{}]çå®ç¯è®¢å"); |
| | | throw new IllegalArgumentException("æªæ¾å°å¯¹åºçå®ç¯è®¢å"); |
| | |
| | | List<String> list = Arrays.asList(productionIds.split(",")); |
| | | LambdaQueryWrapper<Factory> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Factory::getDelFlag, CommonConstant.DEL_FLAG_0); |
| | | // queryWrapper.eq(Factory::getFactoryCategory, "PRODUCTION_LINE"); |
| | | queryWrapper.eq(Factory::getFactoryCategory, "3"); |
| | | queryWrapper.in(Factory::getId, list); |
| | | queryWrapper.orderByAsc(Factory::getSorter); |
| | | return super.list(queryWrapper); |
| | |
| | | import org.jeecg.common.util.PasswordUtil; |
| | | import org.jeecg.common.util.RestUtil; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.andon.dto.AndonButtonDTO; |
| | | import org.jeecg.modules.andon.dto.AndonOrdeDto; |
| | | import org.jeecg.modules.mes.entity.FeishuUser; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | |
| | | * 2. ä¸çº§ååºæ¶é¿åæ£æ¥ç¶æï¼æªå¤çååéäºçº§ |
| | | * 3. äºçº§ååºæ¶é¿åæ£æ¥ç¶æï¼æªå¤çååéä¸çº§ |
| | | */ |
| | | public boolean sendAndonNotification(String accessToken, AndonButtonDTO andonOrde) { |
| | | public boolean sendAndonNotification(String accessToken, AndonOrdeDto andonOrde) { |
| | | try { |
| | | String currentTime = sdf.format(new Date()); |
| | | log.info("ã{}ã触åä¸çº§ååºï¼å级ååºï¼ï¼å®ç¯ID: {}", currentTime, andonOrde.getId()); |
| | |
| | | * åéæå®çº§å«çéç¥ |
| | | * @param level 1-ä¸çº§ï¼2-äºçº§ï¼3-ä¸çº§ |
| | | */ |
| | | private boolean sendLevelNotification(String accessToken, AndonButtonDTO andonOrde, int level) { |
| | | private boolean sendLevelNotification(String accessToken, AndonOrdeDto andonOrde, int level) { |
| | | try { |
| | | String levelDesc = getLevelDesc(level); |
| | | String openId = getResponderOpenId(andonOrde, level); |
| | |
| | | * @param currentLevel å½åçº§å« |
| | | * @param delayMinutes å»¶è¿åéæ°ï¼ç±å½å级å«ååºæ¶é¿å³å®ï¼ |
| | | */ |
| | | private void scheduleNextLevelNotification(String accessToken, AndonButtonDTO andonOrde, int currentLevel, int delayMinutes) { |
| | | private void scheduleNextLevelNotification(String accessToken, AndonOrdeDto andonOrde, int currentLevel, int delayMinutes) { |
| | | int nextLevel = currentLevel + 1; |
| | | if (nextLevel > 3) { |
| | | log.info("å·²å°è¾¾æé«çº§å«éç¥ï¼æ éç»§ç»è°åº¦ï¼å®ç¯ID: {}", andonOrde.getId()); |
| | |
| | | /** |
| | | * æå»ºéç¥å
容ï¼ä¼ååéç¬¦ï¼æåå¯è¯»æ§ï¼ |
| | | */ |
| | | private String buildNotificationContent(AndonButtonDTO andonOrde, int level) { |
| | | private String buildNotificationContent(AndonOrdeDto andonOrde, int level) { |
| | | // è·åå·¥ååç§°å产线åç§°ï¼å空å¼ä¿æ¤ |
| | | String parentFactoryName = andonOrde.getParentFactoryName() != null ? andonOrde.getParentFactoryName() : "æªç¥å·¥å"; |
| | | String factoryName = andonOrde.getFactoryName() != null ? andonOrde.getFactoryName() : "æªç¥äº§çº¿"; |
| | |
| | | /** |
| | | * éªè¯éç¥ç¸å
³åæ° |
| | | */ |
| | | private boolean validateNotificationParams(AndonButtonDTO andonOrde) { |
| | | private boolean validateNotificationParams(AndonOrdeDto andonOrde) { |
| | | if (andonOrde == null) { |
| | | log.error("å®ç¯è®¢åä¿¡æ¯ä¸ºç©º"); |
| | | return false; |
| | |
| | | } |
| | | |
| | | // å·¥å
·æ¹æ³ï¼è·åååºäººopenId |
| | | private String getResponderOpenId(AndonButtonDTO andonOrde, int level) { |
| | | private String getResponderOpenId(AndonOrdeDto andonOrde, int level) { |
| | | switch (level) { |
| | | case 1: return andonOrde.getResponderOpenId(); |
| | | case 2: return andonOrde.getSecondResponderOpenId(); |
| | |
| | | } |
| | | |
| | | // å·¥å
·æ¹æ³ï¼è·åååºäººåç§° |
| | | private String getResponderName(AndonButtonDTO andonOrde, int level) { |
| | | private String getResponderName(AndonOrdeDto andonOrde, int level) { |
| | | String name = null; |
| | | switch (level) { |
| | | case 1: |
| | |
| | | } |
| | | |
| | | // å·¥å
·æ¹æ³ï¼è·åååºæ¶é¿ï¼ä¸çº§=äºçº§å»¶è¿ï¼äºçº§=ä¸çº§å»¶è¿ï¼ |
| | | private int getResponseDuration(AndonButtonDTO andonOrde, int level) { |
| | | private int getResponseDuration(AndonOrdeDto andonOrde, int level) { |
| | | int duration = 0; |
| | | switch (level) { |
| | | case 1: |
| | |
| | | } |
| | | |
| | | // å·¥å
·æ¹æ³ï¼å¤ææå®çº§å«ååºäººæ¯å¦ææ |
| | | private boolean hasValidResponder(AndonButtonDTO andonOrde, int level) { |
| | | private boolean hasValidResponder(AndonOrdeDto andonOrde, int level) { |
| | | String openId = getResponderOpenId(andonOrde, level); |
| | | return openId != null && !openId.isEmpty(); |
| | | } |