| | |
| | | String PREFIX_USER_TOKEN = "prefix_user_token_"; |
| | | // /** Tokenç¼åæ¶é´ï¼3600ç§å³ä¸å°æ¶ */ |
| | | // int TOKEN_EXPIRE_TIME = 3600; |
| | | /** |
| | | * Tokenç¼åæ¶é´(å°æ¶) |
| | | */ |
| | | Integer TOKEN_EXPIRE_TIME = 1; |
| | | |
| | | /** |
| | | * ç»å½äºç»´ç |
| | |
| | | */ |
| | | String JOB_SEND_MSG = "job_fail_send_msg_role"; |
| | | |
| | | /** |
| | | * é»è®¤å¯ç æå¤§å°è¯æ¬¡æ° |
| | | */ |
| | | //Integer MAX_ATTEMPTS = 3; |
| | | |
| | | /** |
| | | * é»è®¤ç¨æ·é宿¶é¿(åé) |
| | | */ |
| | | //Integer USER_FREEZE_TIME = 5; |
| | | |
| | | /** |
| | | * å¯ç æå¤§å°è¯æ¬¡æ°çåå
¸ç¼å· |
| | | */ |
| | | String DICT_MAX_ATTEMPTS = "login_max_attempts"; |
| | | |
| | | /** |
| | | * ç¨æ·ç»å½å¤±è´¥é宿¶é¿åå
¸ç¼å· |
| | | */ |
| | | String DICT_USER_FREEZE = "user_freeze_time"; |
| | | |
| | | /** |
| | | * redisç»å½æ¬¡æ°key |
| | | */ |
| | | String PREFIX_LOGIN_COUNT = "prefix_login_count_"; |
| | | |
| | | /** |
| | | * tokenç¼åæ¶é´åå
¸ç¼å· |
| | | */ |
| | | String DICT_TOKEN_EXPIRE_TIME = "token_expire_time"; |
| | | |
| | | /** |
| | | * é»è®¤ç¨æ·å¯ç æ´æ¹å¨æ(天) |
| | | */ |
| | | //Integer PASSWORD_EXPIRATION_PERIOD = 90; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ç æ´æ¹å¨æåå
¸ç¼å· |
| | | */ |
| | | String DICT_PASSWORD_EXPIRATION = "password_expiration_period"; |
| | | |
| | | /** |
| | | * ç¨æ·é¦æ¬¡ç»å½å¼ºå¶æ´æ¹åå
¸ç¼å· |
| | | */ |
| | | String DICT_USER_FIRST_LOGIN = "user_first_login"; |
| | | |
| | | } |
| | |
| | | import com.auth0.jwt.interfaces.DecodedJWT; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.common.base.Joiner; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.util.Date; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | |
| | | import org.jeecg.common.util.SpringContextUtils; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author Scott |
| | | * @Date 2018-07-12 14:23 |
| | |
| | | import org.jeecg.config.shiro.filters.JwtFilter; |
| | | import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.DependsOn; |
| | |
| | | filterChainDefinitionMap.put("/sys/common/static/**", "anon");//å¾çé¢è§ &ä¸è½½æä»¶ä¸éå¶token |
| | | filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");//pdfé¢è§ |
| | | filterChainDefinitionMap.put("/generic/**", "anon");//pdfé¢è§éè¦æä»¶ |
| | | filterChainDefinitionMap.put("/sys/user/updatePassword", "anon");//é¦é¡µç¨æ·ä¿®æ¹å¯ç |
| | | |
| | | filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //ç»å½äºç»´ç |
| | | filterChainDefinitionMap.put("/sys/getQrcodeToken/**", "anon"); //ç嬿«ç |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOverFlag; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentOverFlagService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2023-12-05 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨") |
| | | @RestController |
| | | @RequestMapping("/mdc/mdcEquipmentOverFlag") |
| | | public class MdcEquipmentOverFlagController extends JeecgController<MdcEquipmentOverFlag, IMdcEquipmentOverFlagService> { |
| | | |
| | | @Resource |
| | | private IMdcEquipmentOverFlagService mdcEquipmentOverFlagService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param mdcEquipmentOverFlag |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-å页å表æ¥è¯¢") |
| | | @ApiOperation(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-å页å表æ¥è¯¢", notes = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(MdcEquipmentOverFlag mdcEquipmentOverFlag, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<MdcEquipmentOverFlag> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipmentOverFlag, req.getParameterMap()); |
| | | Page<MdcEquipmentOverFlag> page = new Page<MdcEquipmentOverFlag>(pageNo, pageSize); |
| | | IPage<MdcEquipmentOverFlag> pageList = mdcEquipmentOverFlagService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param mdcEquipmentOverFlag |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-æ·»å ") |
| | | @ApiOperation(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-æ·»å ", notes = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody MdcEquipmentOverFlag mdcEquipmentOverFlag) { |
| | | mdcEquipmentOverFlagService.save(mdcEquipmentOverFlag); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param mdcEquipmentOverFlag |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-ç¼è¾") |
| | | @ApiOperation(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-ç¼è¾", notes = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<?> edit(@RequestBody MdcEquipmentOverFlag mdcEquipmentOverFlag) { |
| | | mdcEquipmentOverFlagService.updateById(mdcEquipmentOverFlag); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idå é¤ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-éè¿idå é¤") |
| | | @ApiOperation(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-éè¿idå é¤", notes = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-éè¿idå é¤") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
| | | mdcEquipmentOverFlagService.removeById(id); |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-æ¹éå é¤") |
| | | @ApiOperation(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-æ¹éå é¤", notes = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-æ¹éå é¤") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | this.mdcEquipmentOverFlagService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("æ¹éå 餿åï¼"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-éè¿idæ¥è¯¢") |
| | | @ApiOperation(value = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-éè¿idæ¥è¯¢", notes = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | MdcEquipmentOverFlag mdcEquipmentOverFlag = mdcEquipmentOverFlagService.getById(id); |
| | | return Result.OK(mdcEquipmentOverFlag); |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | | * @param request |
| | | * @param mdcEquipmentOverFlag |
| | | */ |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentOverFlag mdcEquipmentOverFlag) { |
| | | return super.exportXls(request, mdcEquipmentOverFlag, MdcEquipmentOverFlag.class, "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, MdcEquipmentOverFlag.class); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.modules.mdc.entity.MdcProcessCount; |
| | | import org.jeecg.modules.mdc.service.IProcessCountService; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @Description: mdc设å¤å 工个æ°è¡¨ |
| | | * @date 2023/12/7 16:50 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "mdc设å¤å 工个æ°è¡¨") |
| | | @RestController |
| | | @RequestMapping("/mdc/mdcProcessCount") |
| | | public class MdcProcessCountController extends JeecgController<MdcProcessCount, IProcessCountService> { |
| | | |
| | | @Resource |
| | | private IProcessCountService processCountService; |
| | | |
| | | /* *//** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param mdcProcessCountVo |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | *//* |
| | | @AutoLog(value = "mdc设å¤å 工个æ°è¡¨-å页å表æ¥è¯¢") |
| | | @ApiOperation(value = "mdc设å¤å 工个æ°è¡¨-å页å表æ¥è¯¢", notes = "mdc设å¤å 工个æ°è¡¨-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(MdcProcessCountVo mdcProcessCountVo, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | |
| | | }*/ |
| | | } |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | |
| | | try { |
| | | String workshopId = mdcWorkshopEquipmentVo.getWorkshopId(); |
| | | for (String equipmentId : mdcWorkshopEquipmentVo.getEquipmentIdList()) { |
| | | if (!StringUtils.isEmpty(equipmentId) && !"null".equals(equipmentId)) { |
| | | List<MdcEquipment> list = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, equipmentId)); |
| | | if (list != null && !list.isEmpty()) { |
| | | MdcWorkshopEquipment mdcWorkshopEquipment = new MdcWorkshopEquipment(); |
| | | mdcWorkshopEquipment.setWorkshopId(workshopId); |
| | | mdcWorkshopEquipment.setEquipmentId(equipmentId); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Description: 设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2023-12-05 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_equipment_over_flag") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_equipment_over_flag对象", description = "设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨") |
| | | public class MdcEquipmentOverFlag extends JeecgEntity implements Serializable { |
| | | |
| | | |
| | | /** |
| | | * 驱å¨ç±»å |
| | | */ |
| | | @Excel(name = "驱å¨ç±»å", width = 15) |
| | | @ApiModelProperty(value = "驱å¨ç±»å") |
| | | private String driveType; |
| | | /** |
| | | * ç»ææ å¿ |
| | | */ |
| | | @Excel(name = "ç»ææ å¿", width = 15) |
| | | @ApiModelProperty(value = "ç»ææ å¿") |
| | | private String overFlag; |
| | | /** |
| | | * å¤æç»æåæ®µ |
| | | */ |
| | | @Excel(name = "å¤æç»æåæ®µ", width = 15) |
| | | @ApiModelProperty(value = "å¤æç»æåæ®µ") |
| | | private String overField; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.jeecg.common.system.base.entity.JeecgEntity; |
| | | import org.jeecgframework.poi.excel.annotation.Excel; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/27 10:57 |
| | | */ |
| | | @Data |
| | | @TableName("mdc_process_count") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "mdc_process_count对象", description = "设å¤å 工工件个æ°è¡¨") |
| | | public class MdcProcessCount extends JeecgEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 370474448269945391L; |
| | | |
| | | /** |
| | | * 设å¤ç¼å· |
| | | */ |
| | | @Excel(name = "设å¤ç¼å·", width = 15) |
| | | @ApiModelProperty(value = "设å¤ç¼å·") |
| | | private String equipmentId; |
| | | |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | @Excel(name = "设å¤åç§°", width = 20) |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | private String equipmentName; |
| | | |
| | | /** |
| | | * æ¥æ |
| | | */ |
| | | @Excel(name = "æ¥æ", width = 20, format = "yyyy-MM-dd") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "æ¥æ") |
| | | private String theDate; |
| | | |
| | | /** |
| | | * å¼å§æ¶é´ |
| | | */ |
| | | @Excel(name = "å¼å§æ¶é´", width = 20, format = "yyyy-MM-dd") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * ç»ææ¶é´ |
| | | */ |
| | | @Excel(name = "ç»ææ¶é´", width = 20, format = "yyyy-MM-dd") |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | private Date endTime; |
| | | |
| | | /** |
| | | * æ¶é¿ |
| | | */ |
| | | @Excel(name = "æ¶é¿", width = 20) |
| | | @ApiModelProperty(value = "æ¶é¿") |
| | | private Long duration; |
| | | |
| | | /** |
| | | * ç¨åºå· |
| | | */ |
| | | @Excel(name = "ç¨åºå·", width = 20) |
| | | @ApiModelProperty(value = "ç¨åºå·") |
| | | private String sequenceNumber; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.mdc.service.IProcessCountService; |
| | | import org.jeecg.modules.mdc.util.ThrowableUtil; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecg.modules.quartz.entity.SysQuartzLog; |
| | | import org.jeecg.modules.quartz.service.IQuartzJobService; |
| | | import org.jeecg.modules.quartz.service.ISysQuartzLogService; |
| | | import org.jeecg.modules.system.service.ISysAnnouncementService; |
| | | import org.quartz.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/22 10:17 |
| | | */ |
| | | @PersistJobDataAfterExecution |
| | | @DisallowConcurrentExecution |
| | | @Slf4j |
| | | public class RunningProcessCountJob implements Job { |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | | @Resource |
| | | private ISysQuartzLogService sysQuartzLogService; |
| | | |
| | | @Resource |
| | | private ISysAnnouncementService sysAnnouncementService; |
| | | |
| | | @Resource |
| | | private IProcessCountService processCountService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | SysQuartzLog quartzLog = new SysQuartzLog(); |
| | | quartzLog.setCreateTime(new Date()); |
| | | List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | log.info("计ç®å 工工件个æ°åæ¶é´ä»»å¡ RunningProcessCountJob start! æ¶é´:" + DateUtils.now()); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | processCountService.runningProcessCount(); |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | // åéæ¶æ¯éç¥ |
| | | sysAnnouncementService.jobSendMessage("计ç®å 工工件个æ°åæ¶é´ä»»å¡", quartzLog.getExceptionDetail()); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | EquipmentLog getRow(@Param("equipmentid") String equipmentid, @Param("startTime") Date startTime); |
| | | |
| | | Integer selectEquipmentOporation(@Param("equipmentId") String equipmentId); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.jeecg.modules.mdc.dto.EquipmentMachingDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | @InterceptorIgnore(tenantLine = "1") |
| | | @Select("SELECT COUNT(*) FROM SysObjects WHERE XType='U' AND name = '${tableName}'") |
| | | Integer isTableExist(@Param("tableName") String tableName); |
| | | |
| | | @InterceptorIgnore(tenantLine = "1") |
| | | List<Map<String, Object>> findRunningData(@Param("tableName") String saveTableName, @Param("startTime") Date startTime, @Param("endTime") Date endTime); |
| | | |
| | | @InterceptorIgnore(tenantLine = "1") |
| | | List<EquipmentMachingDto> getEquipProgramNum(@Param("tableName") String saveTableName, @Param("startTime") Date startTime, @Param("endTime") Date endTime); |
| | | } |
| | |
| | | List<String> findShiftSort(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | Integer computeShiftTimeCount(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | MdcDeviceCalendar getFirstData(@Param("equipmentId") String equipmentId); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOverFlag; |
| | | |
| | | /** |
| | | * @Description: 设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2023-12-05 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface MdcEquipmentOverFlagMapper extends BaseMapper<MdcEquipmentOverFlag> { |
| | | |
| | | } |
| | |
| | | * æ ¹æ®æ¥ææ¥è¯¢æ°é |
| | | */ |
| | | Integer findAlarmCountByDate(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("vo") MdcAlarmAnalyzeQueryVo vo); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¶é´æ®µå
è¿è¡æ°æ® |
| | | */ |
| | | List<MdcEquipmentRunningSection> selectRunningData(@Param("equipmentId") String equipmentId, @Param("startDate") Date startDate, @Param("endDate") Date endDate); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.MdcProcessCount; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/27 11:07 |
| | | */ |
| | | public interface MdcProcessCountMapper extends BaseMapper<MdcProcessCount> { |
| | | MdcProcessCount getLastData(@Param("equipmentId") String equipmentId); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | IPage<MdcTorqueConfig> pageList(IPage<MdcTorqueConfig> pageData, @Param("mdcTorqueConfig") MdcTorqueConfig mdcTorqueConfig); |
| | | |
| | | MdcTorqueConfig findLast(@Param("equipmentId") String equipmentId); |
| | | } |
| | |
| | | <select id="getRow" resultType="org.jeecg.modules.mdc.entity.EquipmentLog"> |
| | | SELECT top 1 * FROM EquipmentLog WHERE EquipmentID = #{ equipmentid } AND CollectTime <= #{ startTime } AND Oporation in ('0','1','2','3') ORDER BY CollectTime ASC |
| | | </select> |
| | | |
| | | <select id="selectEquipmentOporation" resultType="java.lang.Integer"> |
| | | SELECT TOP 1 Oporation FROM EquipmentLog WHERE EquipmentID = #{ equipmentId } ORDER BY CollectTime DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="getMacingDataList" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto"> |
| | | select top 1 [${tableName}].* from [${tableName}] order by CollectTime desc |
| | | </select> |
| | | |
| | | <select id="findRunningData" resultType="java.util.Map"> |
| | | select [${tableName}].* from [${tableName}] where CollectTime between #{ startTime } AND #{ endTime } order by CollectTime asc |
| | | </select> |
| | | |
| | | <select id="getEquipProgramNum" resultType="org.jeecg.modules.mdc.dto.EquipmentMachingDto"> |
| | | select Programnumber,CollectTime from [${tableName}] where CollectTime > #{startTime} and CollectTime <= #{endTime} and Programnumber is not null |
| | | </select> |
| | | </mapper> |
| | |
| | | t3.sleep_start_date, |
| | | t3.sleep_end_date, |
| | | t3.is_day_span, |
| | | t4.equipment_name |
| | | t4.equipment_name, |
| | | t5.start_time overtimeStartTime, |
| | | t5.end_time overtimeEndTime |
| | | FROM |
| | | mdc_device_calendar t1 |
| | | LEFT JOIN mdc_shift t2 ON t1.shift_id = t2.id |
| | | LEFT JOIN mdc_shift_sub t3 ON t1.shift_sub_id = t3.id |
| | | LEFT JOIN mdc_equipment t4 ON t1.equipment_id = t4.equipment_id |
| | | LEFT JOIN mdc_equipment_overtime t5 ON t5.calendar_id = t1.id |
| | | <where> |
| | | <if test="equipmentId != null and equipmentId != ''"> |
| | | AND t4.equipment_id = #{ equipmentId } |
| | |
| | | AND equipment_id = #{ equipmentId } |
| | | </select> |
| | | |
| | | <select id="getFirstData" resultType="org.jeecg.modules.mdc.entity.MdcDeviceCalendar"> |
| | | SELECT TOP 1 * FROM mdc_device_calendar WHERE equipment_id = #{ equipmentId } ORDER BY effective_date ASC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | WHERE |
| | | t1.the_date <= #{ vo.endTime } |
| | | AND t1.the_date >= #{ vo.startTime } |
| | | <if test="vo.equipmentType != null and vo.equipmentType != '' "> |
| | | AND t2.equipment_type = #{ vo.equipmentType } |
| | | </if> |
| | | <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 "> |
| | | AND t2.equipment_id IN |
| | | <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | |
| | | WHERE |
| | | t1.the_date <= #{ vo.endTime } |
| | | AND t1.the_date >= #{ vo.startTime } |
| | | <if test="vo.equipmentType != null and vo.equipmentType != '' "> |
| | | AND t2.equipment_type = #{ vo.equipmentType } |
| | | </if> |
| | | <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 "> |
| | | AND t2.equipment_id IN |
| | | <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | |
| | | <if test="vo.shiftSubId != null and vo.shiftSubId != ''"> |
| | | AND t1.shift_sub_id = #{ vo.shiftSubId } |
| | | </if> |
| | | <if test="vo.equipmentType != null and vo.equipmentType != '' "> |
| | | AND t2.equipment_type = #{ vo.equipmentType } |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | t2.equipment_id, |
| | |
| | | #{id} |
| | | </foreach> |
| | | </where> |
| | | ORDER BY me.equipment_id |
| | | ORDER BY sd.depart_order |
| | | </select> |
| | | |
| | | <!--æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯å产线信æ¯--> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </where> |
| | | ORDER BY me.equipment_id |
| | | ORDER BY mp.production_order |
| | | </select> |
| | | |
| | | <!--æ ¹æ®å¤§å±è½¦é´idæ¥è¯¢è®¾å¤å表--> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="org.jeecg.modules.mdc.mapper.MdcEquipmentOverFlagMapper"> |
| | | |
| | | </mapper> |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢æ¶é´æ®µå
è¿è¡æ°æ®--> |
| | | <select id="selectRunningData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | mdc_equipment_running_section |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | AND status = '3' |
| | | AND (start_time <= #{ endDate } AND end_time >= #{ startDate }) |
| | | ORDER BY |
| | | start_time |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="org.jeecg.modules.mdc.mapper.MdcProcessCountMapper"> |
| | | |
| | | <select id="getLastData" resultType="org.jeecg.modules.mdc.entity.MdcProcessCount"> |
| | | SELECT TOP 1 * FROM mdc_process_count WHERE equipment_id = #{equipmentId} ORDER BY the_date DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | ORDER BY torque_date ASC |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="findLast" resultType="org.jeecg.modules.mdc.entity.MdcTorqueConfig"> |
| | | SELECT TOP |
| | | 1 * |
| | | FROM |
| | | mdc_torque_config |
| | | WHERE |
| | | equipment_id = #{ equipmentId } |
| | | ORDER BY |
| | | torque_date DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | * è·åè®¾å¤æä¸ªæ¶é´ç¹ä¹åçææ°ä¸æ¡æ°æ® |
| | | */ |
| | | EquipmentLog getRow(String equipmentid, Date startTime); |
| | | |
| | | Integer selectEquipmentOporation(String equipmentId); |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | |
| | | * å¤æè¡¨æ¯å¦åå¨ |
| | | */ |
| | | Boolean isTableExist(String tableName); |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸æ®µæ¶é´å
çæ°æ® |
| | | */ |
| | | List<Map<String, Object>> findRunningData(String tableName, Date startTime, Date endTime); |
| | | |
| | | /** |
| | | * æ¥æ¾æ³å
°å
设å¤è¿è¡çç¨åºå· |
| | | * @param drivetype |
| | | * @param equipmentid |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<EquipmentMachingDto> getEquipProgramNum(String drivetype, String equipmentid, Date startTime, Date endTime); |
| | | } |
| | |
| | | */ |
| | | void generateDeviceCalendar(); |
| | | |
| | | MdcDeviceCalendar getFirstData(String equipmentId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOverFlag; |
| | | |
| | | /** |
| | | * @Description: 设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2023-12-05 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IMdcEquipmentOverFlagService extends IService<MdcEquipmentOverFlag> { |
| | | |
| | | } |
| | |
| | | * æ ¹æ®æ¥ææ¥è¯¢æ¬¡æ° |
| | | */ |
| | | Integer findAlarmCountByDate(String startDate, String endDate, MdcAlarmAnalyzeQueryVo vo); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¶é´æ®µå
è¿è¡æ°æ® |
| | | */ |
| | | List<MdcEquipmentRunningSection> selectRunningData(String equipmentId, Date startDate, Date endDate); |
| | | } |
| | |
| | | */ |
| | | IPage<MdcEquipment> getEquipmentByWorkshopId(Page<MdcEquipment> page, WorkshopEquipmentVo workshopEquipmentVo); |
| | | |
| | | List<String> listEquipmentId(String equipmentType, List<String> equipmentIdList); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.entity.MdcProcessCount; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/23 10:17 |
| | | */ |
| | | public interface IProcessCountService extends IService<MdcProcessCount> { |
| | | |
| | | /** |
| | | * 计ç®å 工工件个æ°åæ¶é´ä»»å¡ |
| | | */ |
| | | void runningProcessCount(); |
| | | |
| | | } |
| | |
| | | public EquipmentLog getRow(String equipmentid, Date startTime) { |
| | | return this.baseMapper.getRow(equipmentid, startTime); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectEquipmentOporation(String equipmentId) { |
| | | return this.baseMapper.selectEquipmentOporation(equipmentId); |
| | | } |
| | | } |
| | |
| | | return count != 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> findRunningData(String tableName, Date startTime, Date endTime) { |
| | | return equipmentWorkLineMapper.findRunningData(tableName, startTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public List<EquipmentMachingDto> getEquipProgramNum(String drivetype, String equipmentid, Date startTime, Date endTime) { |
| | | return equipmentWorkLineMapper.getEquipProgramNum(drivetype + "_" + equipmentid, startTime, endTime); |
| | | } |
| | | |
| | | private List<EquipmentMachingDto> convertData(List<Map<String, Object>> list) { |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | List<EquipmentMachingDto> dto = new ArrayList<>(); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcShiftSub; |
| | | import org.jeecg.modules.mdc.entity.MdcVacationManagement; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcDeviceCalendarMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcDeviceCalendarService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | |
| | | public List<MdcDeviceCalendarVo> listByEquipmentAndDate(String equipmentId, List<String> stringDates) { |
| | | List<MdcDeviceCalendarVo> result = new ArrayList<>(); |
| | | try { |
| | | //æ¥è¯¢é»è®¤çå¶ |
| | | // List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); |
| | | |
| | | for (String stringDate : stringDates) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentId, stringDate); |
| | | if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { |
| | | result.addAll(mdcDeviceCalendarVos); |
| | | } |
| | | // else { |
| | | // acquiesceShift.forEach(mdcDeviceCalendarVo -> { |
| | | // mdcDeviceCalendarVo.setEquipmentId(equipmentId); |
| | | // mdcDeviceCalendarVo.setEffectiveDate(stringDate); |
| | | // }); |
| | | // // 设置é»è®¤çå¶ |
| | | // result.addAll(acquiesceShift); |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MdcDeviceCalendar getFirstData(String equipmentId) { |
| | | return this.baseMapper.getFirstData(equipmentId); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.Collator; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | |
| | | if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } else { |
| | | if (StringUtils.isNotEmpty(vo.getEquipmentType())) { |
| | | List<String> equipmentList = mdcEquipmentService.listEquipmentId(vo.getEquipmentType(), vo.getEquipmentIdList()); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | vo.setEquipmentIdList(equipmentList); |
| | | } else { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | return result; |
| | | } |
| | | } |
| | | // æ¥è¯¢å©ç¨çæ°æ® |
| | | List<MdcEfficiencyDto> efficiencyList = mdcEfficiencyReportMapper.efficiencyList(vo); |
| | | // å©ç¨çç级 |
| | |
| | | // é¨é¨å±çº§ |
| | | List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); |
| | | // æ¥è¯¢ææé¨é¨ä¿¡æ¯ |
| | | List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName)); |
| | | List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartOrder)); |
| | | |
| | | for (MdcEquDepDto mdcEquDepDto : equipmentList) { |
| | | MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); |
| | |
| | | // 产线å±çº§ |
| | | List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); |
| | | // æ¥è¯¢ææäº§çº¿ä¿¡æ¯ |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder)); |
| | | |
| | | for (MdcEquProDto mdcEquProDto : equipmentList) { |
| | | MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); |
| | |
| | | listDtos.add(mdcEfficiencyListDto); |
| | | } |
| | | } |
| | | listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3()))); |
| | | //listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3()))); |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } |
| | | |
| | |
| | | if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } else { |
| | | if (StringUtils.isNotEmpty(vo.getEquipmentType())) { |
| | | List<String> equipmentList = mdcEquipmentService.listEquipmentId(vo.getEquipmentType(), vo.getEquipmentIdList()); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | vo.setEquipmentIdList(equipmentList); |
| | | } else { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | return result; |
| | | } |
| | | } |
| | | // æ¥è¯¢å©ç¨çæ°æ® |
| | | List<MdcEfficiencyDto> efficiencyList = mdcEfficiencyReportMapper.efficiencyPOList(vo); |
| | | // å©ç¨çç级 |
| | |
| | | // é¨é¨å±çº§ |
| | | List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); |
| | | // æ¥è¯¢ææé¨é¨ä¿¡æ¯ |
| | | List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName)); |
| | | List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartOrder)); |
| | | |
| | | for (MdcEquDepDto mdcEquDepDto : equipmentList) { |
| | | MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); |
| | |
| | | // 产线å±çº§ |
| | | List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); |
| | | // æ¥è¯¢ææäº§çº¿ä¿¡æ¯ |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder)); |
| | | |
| | | for (MdcEquProDto mdcEquProDto : equipmentList) { |
| | | MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); |
| | |
| | | listDtos.add(mdcEfficiencyListDto); |
| | | } |
| | | } |
| | | listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3()))); |
| | | // listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3()))); |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } |
| | | |
| | |
| | | if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } else { |
| | | if (StringUtils.isNotEmpty(vo.getEquipmentType())) { |
| | | List<String> equipmentList = mdcEquipmentService.listEquipmentId(vo.getEquipmentType(), vo.getEquipmentIdList()); |
| | | if (equipmentList != null && !equipmentList.isEmpty()) { |
| | | vo.setEquipmentIdList(equipmentList); |
| | | } else { |
| | | result.setMdcEfficiencyList(listDtos); |
| | | return result; |
| | | } |
| | | } |
| | | // çæ¬¡å©ç¨çç级 |
| | | List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("bclyl"); |
| | | // çæ¬¡å©ç¨çæ°æ® |
| | |
| | | // é¨é¨å±çº§ |
| | | List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); |
| | | // æ¥è¯¢ææé¨é¨ä¿¡æ¯ |
| | | List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartName)); |
| | | List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(SysDepart::getDepartOrder)); |
| | | // çæ¬¡åç§°æ¾ç¤ºå¤ç |
| | | String shiftSubName = ""; |
| | | if (StringUtils.isBlank(vo.getShiftId())) { |
| | |
| | | // 产线å±çº§ |
| | | List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); |
| | | // æ¥è¯¢ææäº§çº¿ä¿¡æ¯ |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); |
| | | List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder)); |
| | | |
| | | // çæ¬¡åç§°æ¾ç¤ºå¤ç |
| | | String shiftSubName = ""; |
| | |
| | | listDtos.add(mdcEfficiencyShiftListDto); |
| | | } |
| | | } |
| | | listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3()))); |
| | | // listDtos.sort(((o1, o2) -> Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLevel3(), o2.getLevel3()))); |
| | | result.setMdcEfficiencyList(listDtos); |
| | | } |
| | | return result; |
| | |
| | | } |
| | | } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) { |
| | | // åå°è®¾å¤ä¿¡æ¯ |
| | | vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId())); |
| | | vo.setEquipmentIdList(Arrays.asList(vo.getEquipmentId().split(","))); |
| | | } else { |
| | | // æ¥è¯¢ç¨æ·æ¥æçææè®¾å¤ä¿¡æ¯ |
| | | if ("2".equals(vo.getTypeTree())) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentOverFlag; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentOverFlagMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentOverFlagService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Description: 设å¤ç¨åºæ§è¡ç»ææ å¿è¡¨ |
| | | * @Author: Lius |
| | | * @Date: 2023-12-05 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class MdcEquipmentOverFlagServiceImpl extends ServiceImpl<MdcEquipmentOverFlagMapper, MdcEquipmentOverFlag> implements IMdcEquipmentOverFlagService { |
| | | |
| | | } |
| | |
| | | //è·årunningè¿è¡çæ¥å¿è®°å½ |
| | | List<MdcEquipmentRunningSection> list = this.equipmentRunningTracesLog(equipment.getEquipmentid()); |
| | | if (list != null && !list.isEmpty()) { |
| | | //List<MdcEquipmentRunningSection> equipList = addSequenceNumber(list); //æ·»å ç¨åºå· |
| | | this.ergodicTrim(list); |
| | | super.saveBatch(list); |
| | | List<MdcEquipmentRunningSection> equipList = addSequenceNumber(list); //æ·»å ç¨åºå· |
| | | this.ergodicTrim(equipList); |
| | | super.saveBatch(equipList); |
| | | } |
| | | //è·åæ¥è¦çæ¥å¿è®°å½ |
| | | List<MdcEquipmentRunningSection> errorList = this.equipmentRunningTracesErrorLog(equipment.getEquipmentid()); |
| | |
| | | this.dataSynchronizationHandler(list, errorList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设å¤è¿è¡æ¥å¿æ·»å ç¨åºå· |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public List<MdcEquipmentRunningSection> addSequenceNumber(List<MdcEquipmentRunningSection> list) { |
| | | if (list == null || list.size() < 1) { |
| | | return Collections.emptyList(); |
| | | } |
| | | Equipment equip = null; |
| | | for (MdcEquipmentRunningSection e : list) { |
| | | if (e.getStatus() == 3) { |
| | | equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, e.getEquipmentId())); |
| | | if (StringUtils.isNotBlank(equip.getDrivetype()) && equip.getDrivetype().startsWith("FANUC")) { |
| | | List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipProgramNum(equip.getDrivetype(), equip.getEquipmentid(), |
| | | e.getStartTime(), e.getEndTime()); |
| | | if (esList != null && esList.size() > 1) { |
| | | e.setSequenceNumber(esList.get(0).getProgramnumber()); |
| | | } |
| | | } else if (StringUtils.isNotBlank(equip.getDrivetype()) && equip.getDrivetype().startsWith("SIEMENS")) { |
| | | List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getDrivetype() + "_" + equip.getEquipmentid(), e.getStartTime(), e.getEndTime()); |
| | | if (esList != null && esList.size() > 1) { |
| | | e.setSequenceNumber(esList.get(0).getSequencenumber()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | |
| | | return this.baseMapper.findAlarmCountByDate(startDate, endDate, vo); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcEquipmentRunningSection> selectRunningData(String equipmentId, Date startDate, Date endDate) { |
| | | return this.baseMapper.selectRunningData(equipmentId, startDate, endDate); |
| | | } |
| | | |
| | | private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { |
| | | Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); |
| | | List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); |
| | |
| | | import org.jeecg.modules.mdc.dto.MdcEquDepDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquProDto; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | | import org.jeecg.modules.mdc.entity.ControlSystem; |
| | | import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipment; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcEquipmentMapper; |
| | | import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper; |
| | | import org.jeecg.modules.mdc.model.MdcEquipmentTree; |
| | | import org.jeecg.modules.mdc.service.IControlSystemService; |
| | | import org.jeecg.modules.mdc.service.IEquipmentWorkLineService; |
| | | import org.jeecg.modules.mdc.service.IMdcDriveTypeParamConfigService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil; |
| | | import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentProVo; |
| | | import org.jeecg.modules.mdc.vo.MdcEquipmentVo; |
| | | import org.jeecg.modules.mdc.vo.WorkshopEquipmentVo; |
| | | import org.jeecg.modules.mdc.vo.*; |
| | | import org.jeecg.modules.system.entity.MdcEquipmentDepart; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.MdcProductionEquipment; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | |
| | | private IEquipmentWorkLineService equipmentWorkLineService; |
| | | @Resource |
| | | private IMdcDriveTypeParamConfigService mdcDriveTypeParamConfigService; |
| | | // @Resource |
| | | // private XYZAliasesMapper xyzAliasesMapper; |
| | | // @Resource |
| | | // private IEquipmentXYZService equipmentXYZService; |
| | | // @Resource |
| | | // private IEquipmentBaseInfoService equipmentBaseInfoService; |
| | | // @Resource |
| | | // private IEquipmentTemperatureService equipmentTemperatureService; |
| | | @Resource |
| | | private MdcTorqueConfigMapper mdcTorqueConfigMapper; |
| | | |
| | | @Resource |
| | | private IEquipmentLogService equipmentLogService; |
| | | |
| | | @Override |
| | | public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) { |
| | |
| | | mdcEquipmentDto.setDataPort(mdcEquipment.getDataPort()); |
| | | mdcEquipmentDto.setDataFlag(Integer.parseInt(CommonConstant.STATUS_1)); |
| | | ControlSystem controlSystem = controlSystemService.getByDriveType(mdcEquipmentDto.getDriveType()); |
| | | // æ¥è¯¢è®¾å¤ç¶æ |
| | | Integer oporation = equipmentLogService.selectEquipmentOporation(mdcEquipment.getEquipmentId()); |
| | | |
| | | if (controlSystem != null) { |
| | | //è·å工使°æ®å¹¶åå§å |
| | | String saveTableName = mdcEquipment.getSaveTableName(); |
| | |
| | | } else { |
| | | value = result == null ? null : result.toString(); |
| | | } |
| | | // ZUOLAN设å¤çµæµå段AI01 |
| | | if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) { |
| | | value = BigDecimal.valueOf(Math.random() * 15 + 0).setScale(1, RoundingMode.HALF_UP).toString(); |
| | | } |
| | | // å
¶ä»è®¾å¤çµæµå段 |
| | | if ("spindle_current".equals(englishName)) { |
| | | String devicePower = mdcEquipment.getDevicePower(); |
| | | Object spindleload = jsonObject.get("spindleload"); |
| | | BigDecimal load = spindleload == null ? BigDecimal.ZERO : new BigDecimal(spindleload.toString()); |
| | | if (StringUtils.isNotEmpty(devicePower) && oporation == 3) { |
| | | value = new BigDecimal(devicePower).divide(new BigDecimal("380"), 2, BigDecimal.ROUND_HALF_UP).add(load).toString(); |
| | | } else { |
| | | value = "0"; |
| | | } |
| | | } |
| | | // æç©å段 |
| | | if ("torque".equals(englishName)) { |
| | | MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigMapper.findLast(mdcEquipment.getEquipmentId()); |
| | | if (mdcTorqueConfig != null) { |
| | | value = String.valueOf(mdcTorqueConfig.getTorqueValue()); |
| | | } else { |
| | | value = "0"; |
| | | } |
| | | } |
| | | mdcDriveTypeParamConfig.setValue(value); |
| | | } |
| | | mdcEquipmentDto.setMdcDriveTypeParamConfigList(mdcDriveTypeParamList); |
| | | } |
| | | } |
| | | // // 设å¤åæ æ° è·å设å¤éè¦ééçåæ ä¿¡æ¯ |
| | | // List<XYZAliases> equipmentCoordinateList = xyzAliasesMapper.getCoordinateByEquipmentId(mdcEquipment.getEquipmentId()); |
| | | // // 设å¤ééçåæ ä¿¡æ¯ |
| | | // EquipmentXYZ equipmentXYZ = equipmentXYZService.getByEquipmentId(mdcEquipment.getEquipmentId()); |
| | | // JSONObject jsonEquipmentXYZ = (JSONObject) JSONObject.toJSON(equipmentXYZ); |
| | | // if (equipmentCoordinateList != null && !equipmentCoordinateList.isEmpty()) { |
| | | // for (XYZAliases xyzAliases : equipmentCoordinateList) { |
| | | // String englishName = xyzAliases.getXYZFieldName().toLowerCase(); |
| | | // englishName = englishName.substring(0, 1) + "_" + englishName.substring(1, englishName.length()); |
| | | // englishName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, englishName); |
| | | // Object orgValue = jsonEquipmentXYZ.get(englishName); |
| | | // String value = orgValue != null ? orgValue.toString() : null; |
| | | // // åæ æ°æ®çtitle æ¥èª xyzAliases 表, æ ¹æ® æ¯å¦å
å« absolute å machine 夿æ¯ç»å¯¹åæ è¿æ¯æºåºåæ |
| | | // String title = englishName.substring(0, 1).toUpperCase(); |
| | | // title = englishName.contains("absolute") ? "ç»å¯¹åæ " + title : "æºåºåæ " + title; |
| | | // xyzAliases.setTitle(title); |
| | | // xyzAliases.setValue(value); |
| | | // } |
| | | // mdcEquipmentDto.setXyzAliasesList(equipmentCoordinateList); |
| | | // } |
| | | |
| | | // if (equipmentXYZ != null) { |
| | | // mdcEquipmentDto.setXmachine(equipmentXYZ.getXMachine()); |
| | | // mdcEquipmentDto.setYmachine(equipmentXYZ.getYMachine()); |
| | | // mdcEquipmentDto.setZmachine(equipmentXYZ.getZMachine()); |
| | | // mdcEquipmentDto.setAmachine(equipmentXYZ.getAMachine()); |
| | | // mdcEquipmentDto.setBmachine(equipmentXYZ.getBMachine()); |
| | | // mdcEquipmentDto.setXabsolute(equipmentXYZ.getXAbsolute()); |
| | | // mdcEquipmentDto.setYabsolute(equipmentXYZ.getYAbsolute()); |
| | | // mdcEquipmentDto.setZabsolute(equipmentXYZ.getZAbsolute()); |
| | | // mdcEquipmentDto.setAabsolute(equipmentXYZ.getAAbsolute()); |
| | | // mdcEquipmentDto.setBabsolute(equipmentXYZ.getBAbsolute()); |
| | | // } |
| | | // EquipmentBaseInfo equipmentBaseInfo = equipmentBaseInfoService.getByEquipmentId(mdcEquipment.getEquipmentId()); |
| | | // if (equipmentBaseInfo != null) { |
| | | // mdcEquipmentDto.setMaxAxis(equipmentBaseInfo.getMaxAxis()); |
| | | // mdcEquipmentDto.setValidAxis(equipmentBaseInfo.getValidAxis()); |
| | | // } |
| | | // if (controlSystem.getDriveType().equals("SIEMENS840DSL")) { |
| | | // EquipmentTemperatureDto equipmentTemperature = equipmentTemperatureService.getEquipmentTemperature(mdcEquipment.getEquipmentId()); |
| | | // if (equipmentTemperature != null) { |
| | | // mdcEquipmentDto.setTemperatureX(equipmentTemperature.getX()); |
| | | // mdcEquipmentDto.setTemperatureY(equipmentTemperature.getY()); |
| | | // mdcEquipmentDto.setTemperatureZ(equipmentTemperature.getZ()); |
| | | // mdcEquipmentDto.setTemperatureA(equipmentTemperature.getA()); |
| | | // mdcEquipmentDto.setTemperatureB(equipmentTemperature.getB()); |
| | | // } |
| | | // EquipmentTemperatureDto equipmentLagError = equipmentTemperatureService.getEquipmentLagError(mdcEquipment.getEquipmentId()); |
| | | // if (equipmentLagError != null) { |
| | | // mdcEquipmentDto.setEquipmentLagErrorX(equipmentLagError.getX()); |
| | | // mdcEquipmentDto.setEquipmentLagErrorY(equipmentLagError.getY()); |
| | | // mdcEquipmentDto.setEquipmentLagErrorZ(equipmentLagError.getZ()); |
| | | // mdcEquipmentDto.setEquipmentLagErrorA(equipmentLagError.getA()); |
| | | // mdcEquipmentDto.setEquipmentLagErrorB(equipmentLagError.getB()); |
| | | // } |
| | | // } |
| | | // EquipmentTemperatureDto equipmentCurrent = equipmentTemperatureService.getEquipmentCurrent(mdcEquipment.getEquipmentId()); |
| | | // if (equipmentCurrent != null) { |
| | | // mdcEquipmentDto.setEquipmentCurrentX(equipmentCurrent.getX()); |
| | | // mdcEquipmentDto.setEquipmentCurrentY(equipmentCurrent.getY()); |
| | | // mdcEquipmentDto.setEquipmentCurrentZ(equipmentCurrent.getZ()); |
| | | // mdcEquipmentDto.setEquipmentCurrentA(equipmentCurrent.getA()); |
| | | // mdcEquipmentDto.setEquipmentCurrentB(equipmentCurrent.getB()); |
| | | // } |
| | | } |
| | | return mdcEquipmentDto; |
| | | } |
| | |
| | | return this.baseMapper.getEquipmentByWorkshopId(page, workshopEquipmentVo); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> listEquipmentId(String equipmentType, List<String> equipmentIdList) { |
| | | List<MdcEquipment> list = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentType, equipmentType).in(MdcEquipment::getEquipmentId, equipmentIdList)); |
| | | return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * @param equipmentId |
| | | * @param validDate |
| | | * @param shiftSubId |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | import org.jeecg.modules.mdc.mapper.MdcTorqueConfigMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcTorqueConfigService; |
| | | import org.jeecg.modules.quartz.entity.QuartzJob; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: æç©é
置管ç |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.jeecg.modules.mdc.entity.*; |
| | | import org.jeecg.modules.mdc.mapper.MdcProcessCountMapper; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.util.TimeFieldUtils; |
| | | import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; |
| | | import org.jeecg.modules.mdc.vo.MdcShiftDateVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/11/23 10:17 |
| | | */ |
| | | @Service |
| | | public class ProcessCountServiceImpl extends ServiceImpl<MdcProcessCountMapper, MdcProcessCount> implements IProcessCountService { |
| | | |
| | | @Resource |
| | | private IMdcEquipmentService mdcEquipmentService; |
| | | |
| | | @Resource |
| | | private IMdcDeviceCalendarService mdcDeviceCalendarService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentOverFlagService mdcEquipmentOverFlagService; |
| | | |
| | | @Resource |
| | | private IEquipmentWorkLineService equipmentWorkLineService; |
| | | |
| | | /** |
| | | * 计ç®å 工工件个æ°åæ¶é´ä»»å¡ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public void runningProcessCount() { |
| | | // è·åææè®¾å¤ |
| | | List<MdcEquipment> mdcEquipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140244")); |
| | | List<MdcProcessCount> result = new ArrayList<>(); |
| | | for (MdcEquipment mdcEquipment : mdcEquipmentList) { |
| | | List<MdcProcessCount> mdcProcessCountList = processCount(mdcEquipment); |
| | | if (mdcProcessCountList != null && !mdcProcessCountList.isEmpty()) { |
| | | result.addAll(mdcProcessCountList); |
| | | } |
| | | } |
| | | if (!result.isEmpty()) { |
| | | this.saveBatch(result); |
| | | } |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |
| | | List<MdcProcessCount> processCount(MdcEquipment mdcEquipment) { |
| | | Date initDate = null; |
| | | //åæåçç»è®¡æ°æ® |
| | | MdcProcessCount lastData = this.baseMapper.getLastData(mdcEquipment.getEquipmentId()); |
| | | Boolean flag = true; |
| | | if (lastData != null) { |
| | | initDate = DateUtils.toDate(lastData.getTheDate(), DateUtils.STRDATE); |
| | | initDate = DateUtils.plusTime(initDate, 1); |
| | | } else { |
| | | //忬¡åå¼ åææ©æ¶é´ |
| | | MdcDeviceCalendar mdcDeviceCalendar = mdcDeviceCalendarService.getFirstData(mdcEquipment.getEquipmentId()); |
| | | if (mdcDeviceCalendar != null) { |
| | | initDate = DateUtils.toDate(mdcDeviceCalendar.getEffectiveDate(), DateUtils.STRDATE); |
| | | } |
| | | } |
| | | if (initDate == null) { |
| | | return null; |
| | | } |
| | | Date endDate = DateUtils.plusTime(DateUtils.getNow(), 0); |
| | | if (!DateUtils.less(initDate, endDate)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | //è·å两个æ¶é´æ®µçå·® |
| | | List<String> stringDates = DateUtils.getDatesStringList2(initDate, DateUtils.plusTime(endDate, -1)); |
| | | if (stringDates.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // è·å设å¤çæ¬¡ä¿¡æ¯ |
| | | Map<String, List<MdcDeviceCalendarVo>> listMap = this.mdcDeviceCalendarMap(mdcEquipment.getEquipmentId(), stringDates); |
| | | if (listMap.isEmpty()) { |
| | | listMap = new HashMap<>(); |
| | | } |
| | | List<MdcProcessCount> resultList = new ArrayList<>(); |
| | | for (String stringDate : stringDates) { |
| | | if (listMap.containsKey(stringDate)) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = listMap.get(stringDate); |
| | | for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) { |
| | | // å¤ççå¶ç次æ¶é´ |
| | | List<MdcShiftDateVo> datesListByMdcDeviceCalendarVo = this.getDatesListByMdcDeviceCalendarVo(mdcDeviceCalendarVo); |
| | | if (datesListByMdcDeviceCalendarVo == null || datesListByMdcDeviceCalendarVo.isEmpty()) { |
| | | break; |
| | | } |
| | | for (MdcShiftDateVo mdcShiftDateVo : datesListByMdcDeviceCalendarVo) { |
| | | Date startDate = null; |
| | | //å¤çæ°æ® |
| | | //List<MdcProcessCount> result = new ArrayList<>(); |
| | | // æ¥è¯¢ç次å
设å¤è¿è¡ç¶ææ¶é´æ®µ |
| | | List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.selectRunningData(mdcEquipment.getEquipmentId(), mdcShiftDateVo.getStartDate(), mdcShiftDateVo.getEndDate()); |
| | | if (equipmentRunningSectionList != null && !equipmentRunningSectionList.isEmpty()) { |
| | | // æ¶é´ä¿®æ£ |
| | | equipmentRunningSectionList.get(0).setStartTime(mdcShiftDateVo.getStartDate()); |
| | | if (equipmentRunningSectionList.size() > 1) { |
| | | equipmentRunningSectionList.get(equipmentRunningSectionList.size() - 1).setEndTime(mdcShiftDateVo.getEndDate()); |
| | | } else { |
| | | equipmentRunningSectionList.get(0).setEndTime(mdcShiftDateVo.getEndDate()); |
| | | } |
| | | if (!"FANUC".equals(mdcEquipment.getDriveType())) { |
| | | MdcEquipmentOverFlag equipmentOverFlag = mdcEquipmentOverFlagService.getOne(new LambdaQueryWrapper<MdcEquipmentOverFlag>().eq(MdcEquipmentOverFlag::getDriveType, mdcEquipment.getDriveType())); |
| | | if (equipmentOverFlag == null) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | for (int j = 0; j < equipmentRunningSectionList.size(); j++) { |
| | | MdcEquipmentRunningSection mdcEquipmentRunningSection = equipmentRunningSectionList.get(j); |
| | | // æ¥æ¾è®¾å¤å表è¿è¡æ°æ® |
| | | List<Map<String, Object>> mdcEquipmentDtoList = equipmentWorkLineService.findRunningData(mdcEquipment.getSaveTableName(), mdcEquipmentRunningSection.getStartTime(), mdcEquipmentRunningSection.getEndTime()); |
| | | if (mdcEquipmentDtoList == null || mdcEquipmentDtoList.isEmpty()) { |
| | | continue; |
| | | } |
| | | MdcProcessCount mdcProcessCount = new MdcProcessCount(); |
| | | mdcProcessCount.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcProcessCount.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | mdcProcessCount.setTheDate(mdcShiftDateVo.getDay()); |
| | | if (lastData != null && flag) { |
| | | mdcProcessCount.setStartTime(lastData.getEndTime()); |
| | | startDate = mdcProcessCount.getStartTime(); |
| | | flag = false; |
| | | } else if (startDate == null) { |
| | | mdcProcessCount.setStartTime(mdcEquipmentRunningSection.getStartTime()); |
| | | startDate = mdcProcessCount.getStartTime(); |
| | | } else { |
| | | mdcProcessCount.setStartTime(startDate); |
| | | } |
| | | if ("FANUC".equals(mdcEquipment.getDriveType())) { |
| | | // æ³å
°å
è®¾å¤æ ¹æ®ProductCountåæ®µå¤æ |
| | | String productCount = mdcEquipmentDtoList.get(0).get("ProductCount").toString(); |
| | | for (int i = 0; i < mdcEquipmentDtoList.size(); i++) { |
| | | if (!productCount.equals(mdcEquipmentDtoList.get(i).get("ProductCount").toString())) { |
| | | productCount = mdcEquipmentDtoList.get(i).get("ProductCount").toString(); |
| | | if (mdcEquipmentDtoList.get(i - 1).get("CollectTime") != null) { |
| | | mdcProcessCount.setEndTime(DateUtils.toDate(mdcEquipmentDtoList.get(i - 1).get("CollectTime").toString(), DateUtils.STR_DATE_TIME)); |
| | | mdcProcessCount.setDuration(TimeFieldUtils.duration(mdcProcessCount.getStartTime(), mdcProcessCount.getEndTime())); |
| | | mdcProcessCount.setSequenceNumber(mdcEquipmentDtoList.get(i - 1).get("Sequencenumber").toString()); |
| | | resultList.add(mdcProcessCount); |
| | | if (TimeFieldUtils.duration(mdcProcessCount.getEndTime(), mdcEquipmentRunningSection.getEndTime()) > 60) { |
| | | //mdcProcessCount.setStartTime(mdcProcessCount.getEndTime()); |
| | | startDate = mdcProcessCount.getEndTime(); |
| | | } else if (j + 1 < equipmentRunningSectionList.size()) { |
| | | //mdcProcessCount.setStartTime(equipmentRunningSectionList.get(j + 1).getStartTime()); |
| | | startDate = equipmentRunningSectionList.get(j + 1).getStartTime(); |
| | | } else { |
| | | startDate = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | |
| | | private List<MdcShiftDateVo> getDatesListByMdcDeviceCalendarVo(MdcDeviceCalendarVo temp) { |
| | | List<MdcShiftDateVo> result = new ArrayList<>(); |
| | | String startDateStr = temp.getStartDate(); |
| | | String endDateStr = temp.getEndDate(); |
| | | String sleepStartDateStr = temp.getSleepStartDate(); |
| | | String sleepEndDateStr = temp.getSleepEndDate(); |
| | | String effectiveDateStr = temp.getEffectiveDate(); |
| | | String overtimeStartTime = temp.getOvertimeStartTime(); |
| | | String overtimeEndTime = temp.getOvertimeEndTime(); |
| | | String eff = DateUtils.format(DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE), DateUtils.STR_DATE); |
| | | try { |
| | | Date effectiveDate = new SimpleDateFormat("yyyyMMdd").parse(effectiveDateStr); |
| | | long startDate = getLongDate(effectiveDate, startDateStr, "false"); |
| | | long endDate = getLongDate(effectiveDate, endDateStr, temp.getIsDaySpan()); |
| | | //å¤çæåçæ¶é´é®é¢ æ¯å¦è¶
è¿å½åæ¶é´ 妿è¶
è¿ä¸åå
¥è®¡ç® BUG |
| | | Date endTime = null; |
| | | if ("true".equals(temp.getIsDaySpan())) { |
| | | Date day = DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE); |
| | | day = DateUtils.plusTime(day, 1); |
| | | String dayTime = DateUtils.format(day, DateUtils.STR_DATE); |
| | | endTime = DateUtils.toDate(dayTime + " " + temp.getEndDate(), DateUtils.STR_DATE_TIME_SMALL); |
| | | } else { |
| | | Date day = DateUtils.toDate(effectiveDateStr, DateUtils.STRDATE); |
| | | String dayTime = DateUtils.format(day, DateUtils.STR_DATE); |
| | | endTime = DateUtils.toDate(dayTime + " " + temp.getEndDate(), DateUtils.STR_DATE_TIME_SMALL); |
| | | } |
| | | if (endTime.getTime() > DateUtils.getNow().getTime()) { |
| | | return null; |
| | | } |
| | | if (StringUtils.isNotEmpty(sleepStartDateStr)) { |
| | | long sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, "false"); |
| | | long sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, "false"); |
| | | Date start1 = DateUtils.getFormatDate(eff + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL); |
| | | Date end1 = DateUtils.getFormatDate(eff + " " + sleepStartDateStr, DateUtils.STR_DATE_TIME_SMALL); |
| | | Date start2 = DateUtils.getFormatDate(eff + " " + sleepEndDateStr, DateUtils.STR_DATE_TIME_SMALL); |
| | | Date end2 = DateUtils.getFormatDate(eff + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL); |
| | | if ("true".equals(temp.getIsDaySpan())) { |
| | | //跨天 å¤æçæ¬¡å¼å§æ¶é´åç»ææ¶é´æ¯å¦è·¨å¤© |
| | | if (startDateStr.compareTo(endDateStr) < 0) { |
| | | //çæ¬¡å¼å§æ¶é´åç»ææ¶é´é½è·¨å¤© |
| | | startDate = getLongDate(effectiveDate, startDateStr, temp.getIsDaySpan()); |
| | | start1 = DateUtils.addDays(start1, 1); |
| | | end2 = DateUtils.addDays(end2, 1); |
| | | //çæ¬¡å¼å§æ¶é´åç»ææ¶é´é½è·¨å¤© 伿¯å¼å§æ¶é´åç»ææ¶é´ä¹ä¸å®è·¨å¤© |
| | | sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, temp.getIsDaySpan()); |
| | | end1 = DateUtils.addDays(end1, 1); |
| | | sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan()); |
| | | start2 = DateUtils.addDays(start2, 1); |
| | | } else { |
| | | //çæ¬¡å¼å§æ¶é´ä¸è·¨å¤©ï¼ ç»ææ¶é´è·¨å¤© |
| | | end2 = DateUtils.addDays(end2, 1); |
| | | //夿伿¯å¼å§æ¶é´æ¯å¦è·¨å¤© |
| | | if (startDateStr.compareTo(sleepStartDateStr) > 0) { |
| | | //å¼å§ä¼æ¯æ¶é´è·¨å¤©ï¼ ç»æä¼æ¯æ¶é´ä¹ä¸å®è·¨å¤© |
| | | sleepStartDate = getLongDate(effectiveDate, sleepStartDateStr, temp.getIsDaySpan()); |
| | | end1 = DateUtils.addDays(end1, 1); |
| | | sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan()); |
| | | start2 = DateUtils.addDays(start2, 1); |
| | | } else { |
| | | //伿¯å¼å§æ¶é´ä¸è·¨å¤©, 夿伿¯ç»ææ¶é´æ¯å¦è·¨å¤© |
| | | if (sleepStartDateStr.compareTo(sleepEndDateStr) > 0) { |
| | | //伿¯ç»ææ¶é´è·¨å¤© |
| | | sleepEndDate = getLongDate(effectiveDate, sleepEndDateStr, temp.getIsDaySpan()); |
| | | start2 = DateUtils.addDays(start2, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | MdcShiftDateVo dates1 = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, sleepStartDate, effectiveDateStr, endTime, start1, end1); |
| | | result.add(dates1); |
| | | MdcShiftDateVo dates2 = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), sleepEndDate, endDate, effectiveDateStr, endTime, start2, end2); |
| | | result.add(dates2); |
| | | } else { |
| | | /*è·åçæ¬¡çå¼å§æ¶é´ç»ææ¶é´*/ |
| | | Date start = DateUtils.getFormatDate(eff + " " + startDateStr, DateUtils.STR_DATE_TIME_SMALL); |
| | | Date end = DateUtils.getFormatDate(eff + " " + endDateStr, DateUtils.STR_DATE_TIME_SMALL); |
| | | if ("true".equals(temp.getIsDaySpan())) { |
| | | if (startDateStr.compareTo(endDateStr) < 0) { |
| | | startDate = getLongDate(effectiveDate, startDateStr, temp.getIsDaySpan()); |
| | | start = DateUtils.addDays(start, 1); |
| | | } |
| | | end = DateUtils.addDays(end, 1); |
| | | } |
| | | MdcShiftDateVo dates = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, endDate, effectiveDateStr, endTime, start, end); |
| | | result.add(dates); |
| | | } |
| | | // å¤çå çæ¶é´ |
| | | if (StringUtils.isNotEmpty(overtimeStartTime)) { |
| | | Date start = DateUtils.getFormatDate(eff + " " + overtimeStartTime, DateUtils.STR_DATE_TIME_SMALL); |
| | | Date end = DateUtils.getFormatDate(eff + " " + overtimeEndTime, DateUtils.STR_DATE_TIME_SMALL); |
| | | if ("true".equals(temp.getIsDaySpan())) { |
| | | start = DateUtils.addDays(start, 1); |
| | | end = DateUtils.addDays(end, 1); |
| | | } |
| | | MdcShiftDateVo dates = new MdcShiftDateVo(temp.getShiftId(), temp.getShiftSubId(), startDate, endDate, effectiveDateStr, endTime, start, end); |
| | | result.add(dates); |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private Map<String, List<MdcDeviceCalendarVo>> mdcDeviceCalendarMap(String equipmentId, List<String> stringDates) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = mdcDeviceCalendarService.listByEquipmentAndDate(equipmentId, stringDates); |
| | | if (mdcDeviceCalendarVos.isEmpty()) { |
| | | return null; |
| | | } |
| | | Map<String, List<MdcDeviceCalendarVo>> map = new HashMap<>(); |
| | | for (MdcDeviceCalendarVo mdcDeviceCalendarVo : mdcDeviceCalendarVos) { |
| | | List<MdcDeviceCalendarVo> mdcDeviceCalendarVos1; |
| | | if (map.containsKey(mdcDeviceCalendarVo.getEffectiveDate())) { |
| | | mdcDeviceCalendarVos1 = map.get(mdcDeviceCalendarVo.getEffectiveDate()); |
| | | } else { |
| | | mdcDeviceCalendarVos1 = new ArrayList<>(); |
| | | } |
| | | mdcDeviceCalendarVos1.add(mdcDeviceCalendarVo); |
| | | map.put(mdcDeviceCalendarVo.getEffectiveDate(), mdcDeviceCalendarVos1); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | private long getLongDate(Date effectiveDate, String startDateStr, String isDaySpan) { |
| | | String[] startDateArray = startDateStr.split(":"); |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(effectiveDate); |
| | | cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(startDateArray[0])); |
| | | cal.set(Calendar.MINUTE, Integer.parseInt(startDateArray[1])); |
| | | cal.set(Calendar.SECOND, Integer.parseInt(startDateArray[2])); |
| | | if ("true".equals(isDaySpan)) { |
| | | cal.add(Calendar.DAY_OF_YEAR, 1); |
| | | } |
| | | return cal.getTime().getTime(); |
| | | } |
| | | } |
| | |
| | | private String isDaySpan; |
| | | private String equipmentName; |
| | | // private String equipmentId; |
| | | |
| | | private String overtimeStartTime; |
| | | private String overtimeEndTime; |
| | | } |
| | |
| | | */ |
| | | private List<String> equipmentIdList; |
| | | |
| | | /** |
| | | * 设å¤ç±»å |
| | | */ |
| | | private String equipmentType; |
| | | |
| | | } |
| | |
| | | * 设å¤ids |
| | | */ |
| | | private List<String> equipmentIdList; |
| | | /** |
| | | * 设å¤ç±»å |
| | | */ |
| | | private String equipmentType; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.mdc.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author Lius |
| | | * @date 2023/12/7 16:55 |
| | | */ |
| | | @Data |
| | | public class MdcProcessCountVo { |
| | | private String equipmentId; |
| | | private String equipmentName; |
| | | private String driveType; |
| | | private String sequenceNumber; |
| | | private String theDate; |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.constant.SymbolConstant; |
| | | import org.jeecg.common.system.util.JwtUtil; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.*; |
| | | import org.jeecg.common.util.encryption.EncryptedString; |
| | |
| | | import org.jeecg.modules.system.util.RandImageUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | return result; |
| | | }*/ |
| | | //update-end-author:taoyan date:20190828 for:æ ¡éªéªè¯ç |
| | | |
| | | |
| | | //1. æ ¡éªç¨æ·æ¯å¦ææ |
| | | //update-begin-author:wangshuai date:20200601 for: ç»å½ä»£ç éªè¯ç¨æ·æ¯å¦æ³¨ébugï¼ifæ¡ä»¶æ°¸è¿ä¸ºfalse |
| | | LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); |
| | | String syspassword = sysUser.getPassword(); |
| | | if (!syspassword.equals(userpassword)) { |
| | | result.error500("ç¨æ·åæå¯ç é误"); |
| | | // è·åç¨æ·å¤±è´¥æå¤§æ¬¡æ° |
| | | //Integer maxAttempts = CommonConstant.MAX_ATTEMPTS; |
| | | List<DictModel> dictModels = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MAX_ATTEMPTS); |
| | | if (dictModels != null && !dictModels.isEmpty()) { |
| | | Integer maxAttempts = Integer.valueOf(dictModels.get(0).getValue()); |
| | | if (redisUtil.hasKey(CommonConstant.PREFIX_LOGIN_COUNT + username)) { |
| | | Integer loginCount = (Integer) redisUtil.get(CommonConstant.PREFIX_LOGIN_COUNT + username) + 1; |
| | | if (loginCount < maxAttempts) { |
| | | result.error500("ç¨æ·åæå¯ç é误ï¼è¯·éæ°å°è¯ãå©ä½å°è¯æ¬¡æ°ï¼" + (maxAttempts - loginCount)); |
| | | redisUtil.set(CommonConstant.PREFIX_LOGIN_COUNT + username, loginCount + 1, 300); |
| | | } else if (loginCount.equals(maxAttempts)) { |
| | | // è¶
è¿æå¤§ç»å½æ¬¡æ° éå®ç¨æ· |
| | | //sysUserService.update(new SysUser().setStatus(CommonConstant.USER_FREEZE), new UpdateWrapper<SysUser>().lambda().eq(SysUser::getUsername, username)); |
| | | // è·åç¨æ·å¤±è´¥é宿¶é¿ |
| | | List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_USER_FREEZE); |
| | | if (dictModelList != null && !dictModelList.isEmpty()) { |
| | | Integer userFreezeTime = Integer.valueOf(dictModelList.get(0).getValue()); |
| | | redisUtil.set(CommonConstant.PREFIX_LOGIN_COUNT + username, loginCount + 1, userFreezeTime * 60); |
| | | result.error500("ç¨æ·åæå¯ç é误ï¼å·²å°è¾¾æå¤§å°è¯æ¬¡æ°ï¼è¯·ç¨åå°è¯ï¼"); |
| | | } else { |
| | | //ä¿®æ¹æ°æ®åºéå®ç¨æ· |
| | | sysUserService.update(new SysUser().setStatus(CommonConstant.USER_FREEZE), new UpdateWrapper<SysUser>().lambda().eq(SysUser::getUsername, username)); |
| | | //å é¤redisä¿¡æ¯ |
| | | redisUtil.del(CommonConstant.PREFIX_LOGIN_COUNT + username); |
| | | result.error500("ç¨æ·åæå¯ç é误ï¼å·²å°è¾¾æå¤§å°è¯æ¬¡æ°ï¼è¯·è系管çåè§£éï¼"); |
| | | } |
| | | |
| | | } else { |
| | | result.error500("æ¨çè´¦æ·å·²éå®ï¼è¯·ç¨åå°è¯ï¼"); |
| | | } |
| | | } else { |
| | | redisUtil.set(CommonConstant.PREFIX_LOGIN_COUNT + username, 1, 300); |
| | | result.error500("ç¨æ·åæå¯ç é误ï¼è¯·éæ°å°è¯ãå©ä½å°è¯æ¬¡æ°ï¼" + (maxAttempts - 1)); |
| | | } |
| | | } |
| | | |
| | | |
| | | //result.error500("ç¨æ·åæå¯ç é误"); |
| | | return result; |
| | | } else { |
| | | if (redisUtil.hasKey(CommonConstant.PREFIX_LOGIN_COUNT + username)) { |
| | | redisUtil.del(CommonConstant.PREFIX_LOGIN_COUNT + username); |
| | | } |
| | | } |
| | | |
| | | |
| | | //ç¨æ·ç»å½ä¿¡æ¯ |
| | | userInfo(sysUser, result); |
| | | //update-begin--Author:liusq Date:20210126 forï¼ç»å½æåï¼å é¤redisä¸çéªè¯ç |
| | |
| | | } |
| | | //update-begin---author:liusq ---date:2022-06-29 forï¼æ¥å£è¿åå¼ä¿®æ¹ï¼åæ¥ä¿®æ¹è¿éç夿é»è¾----------- |
| | | //update-end---author:scott ---date::2022-06-20 forï¼vue3åç«¯ï¼æ¯æèªå®ä¹é¦é¡µ-------------- |
| | | |
| | | |
| | | obj.put("userInfo",sysUser); |
| | | obj.put("sysAllDictItems", sysDictService.queryAllDictItems()); |
| | | result.setResult(obj); |
| | |
| | | return result; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * éåºç»å½ |
| | | * @param request |
| | |
| | | return Result.error("Tokenæ æ!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·å访é®é |
| | | * @return |
| | |
| | | result.success("ç»å½æå"); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·å访é®é |
| | | * @return |
| | |
| | | result.setResult(oConvertUtils.toLowerCasePageList(list)); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * ç»éæåéæ©ç¨æ·å½åé¨é¨ |
| | | * @param user |
| | |
| | | |
| | | /** |
| | | * çä¿¡ç»å½æ¥å£ |
| | | * |
| | | * |
| | | * @param jsonObject |
| | | * @return |
| | | */ |
| | |
| | | result.setSuccess(false); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | | String redisKey = CommonConstant.PHONE_REDIS_KEY_PRE+mobile; |
| | | Object object = redisUtil.get(redisKey); |
| | | //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | | |
| | | |
| | | if (object != null) { |
| | | result.setMessage("éªè¯ç 10åéå
ï¼ä»ç¶ææï¼"); |
| | | result.setSuccess(false); |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * smsmode çä¿¡æ¨¡æ¿æ¹å¼ 0 .ç»å½æ¨¡æ¿ã1.æ³¨åæ¨¡æ¿ã2.å¿è®°å¯ç æ¨¡æ¿ |
| | | */ |
| | |
| | | result.setSuccess(false); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | | //éªè¯ç 10åéå
ææ |
| | | redisUtil.set(redisKey, captcha, 600); |
| | | //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | | |
| | | |
| | | //update-begin--Author:scott Date:20190812 forï¼issues#391 |
| | | //result.setResult(captcha); |
| | | //update-end--Author:scott Date:20190812 forï¼issues#391 |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * ææºå·ç»å½æ¥å£ |
| | | * |
| | | * |
| | | * @param jsonObject |
| | | * @return |
| | | */ |
| | |
| | | public Result<JSONObject> phoneLogin(@RequestBody JSONObject jsonObject) { |
| | | Result<JSONObject> result = new Result<JSONObject>(); |
| | | String phone = jsonObject.getString("mobile"); |
| | | |
| | | |
| | | //æ ¡éªç¨æ·æææ§ |
| | | SysUser sysUser = sysUserService.getUserByPhone(phone); |
| | | result = sysUserService.checkUserIsEffective(sysUser); |
| | | if(!result.isSuccess()) { |
| | | return result; |
| | | } |
| | | |
| | | |
| | | String smscode = jsonObject.getString("captcha"); |
| | | |
| | | //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | |
| | | |
| | | // çætoken |
| | | String token = JwtUtil.sign(username, syspassword); |
| | | // è·åtokenç¼åæææ¶é´ |
| | | Integer expireTime = CommonConstant.TOKEN_EXPIRE_TIME; |
| | | List<DictModel> dictModels = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_TOKEN_EXPIRE_TIME); |
| | | if (dictModels != null && !dictModels.isEmpty()) { |
| | | expireTime = Integer.valueOf(dictModels.get(0).getValue()); |
| | | } |
| | | // 设置tokenç¼åæææ¶é´ |
| | | redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token); |
| | | redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000); |
| | | redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token, (long) (expireTime + 1) * 60 * 60); |
| | | |
| | | //redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, ); |
| | | obj.put("token", token); |
| | | |
| | | // update-begin--Author:sunjianlei Date:20210802 forï¼è·åç¨æ·ç§æ·ä¿¡æ¯ |
| | |
| | | String code = RandomUtil.randomString(BASE_CHECK_CODES,4); |
| | | //åå°redisä¸ |
| | | String lowerCaseCode = code.toLowerCase(); |
| | | |
| | | |
| | | //update-begin-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | | // å å
¥å¯é¥ä½ä¸ºæ··æ·ï¼é¿å
ç®åçæ¼æ¥ï¼è¢«å¤é¨å©ç¨ï¼ç¨æ·èªå®ä¹è¯¥å¯é¥å³å¯ |
| | | String origin = lowerCaseCode+key+jeecgBaseConfig.getSignatureSecret(); |
| | | String realKey = Md5Util.md5Encode(origin, "utf-8"); |
| | | //update-end-author:taoyan date:2022-9-13 for: VUEN-2245 ãæ¼æ´ãåç°æ°æ¼æ´å¾
å¤ç20220906 |
| | | |
| | | |
| | | redisUtil.set(realKey, lowerCaseCode, 60); |
| | | log.info("è·åéªè¯ç ï¼Redis key = {}ï¼checkCode = {}", realKey, code); |
| | | //è¿åå端 |
| | |
| | | sysPermissionService.switchVue3Menu(); |
| | | return res; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * appç»å½ |
| | | * @param sysLoginModel |
| | |
| | | Result<JSONObject> result = new Result<JSONObject>(); |
| | | String username = sysLoginModel.getUsername(); |
| | | String password = sysLoginModel.getPassword(); |
| | | |
| | | |
| | | //1. æ ¡éªç¨æ·æ¯å¦ææ |
| | | SysUser sysUser = sysUserService.getUserByName(username); |
| | | result = sysUserService.checkUserIsEffective(sysUser); |
| | | if(!result.isSuccess()) { |
| | | return result; |
| | | } |
| | | |
| | | |
| | | //2. æ ¡éªç¨æ·åæå¯ç æ¯å¦æ£ç¡® |
| | | String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt()); |
| | | String syspassword = sysUser.getPassword(); |
| | |
| | | result.error500("ç¨æ·åæå¯ç é误"); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | String orgCode = sysUser.getOrgCode(); |
| | | if(oConvertUtils.isEmpty(orgCode)) { |
| | | //妿å½åç¨æ·æ éæ©é¨é¨ æ¥çé¨é¨å
³èä¿¡æ¯ |
| | |
| | | JSONObject obj = new JSONObject(); |
| | | //ç¨æ·ç»å½ä¿¡æ¯ |
| | | obj.put("userInfo", sysUser); |
| | | |
| | | |
| | | // çætoken |
| | | String token = JwtUtil.sign(username, syspassword); |
| | | // 设置è¶
æ¶æ¶é´ |
| | |
| | | try { |
| | | SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class); |
| | | user.setCreateTime(new Date());//设置å建æ¶é´ |
| | | user.setPasswordTime(new Date());//设置å¯ç æ¶é´ |
| | | user.setPasswordFlag(CommonConstant.DEL_FLAG_1);//设置å¯ç 馿¬¡æ è¯ |
| | | String salt = oConvertUtils.randomGen(8); |
| | | user.setSalt(salt); |
| | | String passwordEncode = PasswordUtil.encrypt(user.getUsername(), user.getPassword(), salt); |
| | |
| | | String oldpassword = json.getString("oldpassword"); |
| | | String password = json.getString("password"); |
| | | String confirmpassword = json.getString("confirmpassword"); |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (!sysUser.getUsername().equals(username)) { |
| | | return Result.error("åªå
许修æ¹èªå·±çå¯ç ï¼"); |
| | | } |
| | | //LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | //if (!sysUser.getUsername().equals(username)) { |
| | | // return Result.error("åªå
许修æ¹èªå·±çå¯ç ï¼"); |
| | | //} |
| | | SysUser user = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, username)); |
| | | if (user == null) { |
| | | return Result.error("ç¨æ·ä¸åå¨ï¼"); |
| | | } |
| | | //update-begin---author:wangshuai ---date:20220316 forï¼[VUEN-234]ä¿®æ¹å¯ç æ·»å æææ¥å¿------------ |
| | | LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | baseCommonService.addLog("ä¿®æ¹å¯ç ï¼usernameï¼ " + loginUser.getUsername(), CommonConstant.LOG_TYPE_2, 2); |
| | | //LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | baseCommonService.addLog("ä¿®æ¹å¯ç ï¼usernameï¼ " + username, CommonConstant.LOG_TYPE_2, 2); |
| | | //update-end---author:wangshuai ---date:20220316 forï¼[VUEN-234]ä¿®æ¹å¯ç æ·»å æææ¥å¿------------ |
| | | return sysUserService.resetPassword(username, oldpassword, password, confirmpassword); |
| | | } |
| | |
| | | @Dict(dicCode = "id",dictTable = "mom_base_team",dicText = "name") |
| | | private String teamId; |
| | | |
| | | /** |
| | | * å¯ç 馿¬¡ä½¿ç¨æ è¯ 1æ¯ 0å¦ |
| | | */ |
| | | private Integer passwordFlag; |
| | | |
| | | /** |
| | | * å¯ç æ´æ°æ¶é´ |
| | | */ |
| | | private Date passwordTime; |
| | | |
| | | |
| | | } |
| | |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.constant.enums.RoleIndexConfigEnum; |
| | | import org.jeecg.common.desensitization.annotation.SensitiveEncode; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.system.vo.SysUserCacheInfo; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.common.util.PasswordUtil; |
| | | import org.jeecg.common.util.UUIDGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | |
| | | import org.jeecg.modules.system.entity.*; |
| | | import org.jeecg.modules.system.mapper.*; |
| | | import org.jeecg.modules.system.model.SysUserSysDepartModel; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.vo.MdcUserProVo; |
| | | import org.jeecg.modules.system.vo.SysUserDepVo; |
| | |
| | | SysRoleIndexMapper sysRoleIndexMapper; |
| | | @Resource |
| | | MdcUserProductionMapper mdcUserProductionMapper; |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | |
| | | @Override |
| | | @CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true) |
| | |
| | | if (!newpassword.equals(confirmpassword)) { |
| | | return Result.error("两次è¾å
¥å¯ç ä¸ä¸è´!"); |
| | | } |
| | | //设置å¯ç æ´æ°æ¶é´ |
| | | //sysUser.setPasswordTime(new Date()); |
| | | //设置å¯ç 馿¬¡ç»å½å¤±æ |
| | | //sysUser.setPasswordFlag(CommonConstant.DEL_FLAG_0); |
| | | String password = PasswordUtil.encrypt(username, newpassword, user.getSalt()); |
| | | this.userMapper.update(new SysUser().setPassword(password), new LambdaQueryWrapper<SysUser>().eq(SysUser::getId, user.getId())); |
| | | this.userMapper.update(new SysUser().setPassword(password).setPasswordTime(new Date()).setPasswordFlag(CommonConstant.DEL_FLAG_0), new LambdaQueryWrapper<SysUser>().eq(SysUser::getId, user.getId())); |
| | | return Result.ok("å¯ç éç½®æå!"); |
| | | } |
| | | |
| | |
| | | public Result<?> changePassword(SysUser sysUser) { |
| | | String salt = oConvertUtils.randomGen(8); |
| | | sysUser.setSalt(salt); |
| | | //设置å¯ç æ´æ°æ¶é´ |
| | | sysUser.setPasswordTime(new Date()); |
| | | String password = sysUser.getPassword(); |
| | | String passwordEncode = PasswordUtil.encrypt(sysUser.getUsername(), password, salt); |
| | | sysUser.setPassword(passwordEncode); |
| | |
| | | result.error500("è¯¥ç¨æ·å·²å»ç»"); |
| | | return result; |
| | | } |
| | | //æ
åµ4ï¼æ ¹æ®ç¨æ·ä¿¡æ¯æ¥è¯¢ï¼è¯¥ç¨æ·å¯ç ç³»é¦æ¬¡ä½¿ç¨ï¼éä¿®æ¹å¯ç |
| | | List<DictModel> dictList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_USER_FIRST_LOGIN); |
| | | if (dictList != null && !dictList.isEmpty()) { |
| | | if (CommonConstant.DEL_FLAG_1.equals(Integer.valueOf(dictList.get(0).getValue())) && CommonConstant.DEL_FLAG_1.equals(sysUser.getPasswordFlag())) { |
| | | baseCommonService.addLog("ç¨æ·ç»å½å¤±è´¥ï¼ç¨æ·å:" + sysUser.getUsername() + "ç³»é¦æ¬¡ç»å½ç³»ç»ï¼è¯·éç½®å¯ç ï¼", CommonConstant.LOG_TYPE_1, null); |
| | | result.setCode(5001); |
| | | result.setMessage("ç¨æ·å¯ç ç³»é»è®¤å¯ç ï¼ééç½®å¯ç åéæ°ç»å½å¯ç ï¼"); |
| | | result.setSuccess(false); |
| | | return result; |
| | | } |
| | | } |
| | | //æ
åµ5ï¼æ ¹æ®ç¨æ·ä¿¡æ¯æ¥è¯¢ï¼è¯¥ç¨æ·å¯ç æ¯å¦å·²è¿æ´æ¹å¨æ |
| | | Date passwordTime = sysUser.getPasswordTime(); |
| | | //Integer passwordExpirationPeriod = CommonConstant.PASSWORD_EXPIRATION_PERIOD; |
| | | List<DictModel> dictModelList = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_PASSWORD_EXPIRATION); |
| | | if (dictModelList != null && !dictModelList.isEmpty()) { |
| | | Integer passwordExpirationPeriod = Integer.valueOf(dictModelList.get(0).getValue()); |
| | | Date dayAfter = DateUtils.getDayAfter(passwordTime, passwordExpirationPeriod); |
| | | if (new Date().after(dayAfter)) { |
| | | baseCommonService.addLog("ç¨æ·ç»å½å¤±è´¥ï¼ç¨æ·å:" + sysUser.getUsername() + "å¯ç å·²è¿æææï¼è¯·éç½®å¯ç ï¼", CommonConstant.LOG_TYPE_1, null); |
| | | result.setCode(5002); |
| | | result.setMessage("ç¨æ·å¯ç å·²è¿æææï¼è¯·éç½®å¯ç ï¼"); |
| | | result.setSuccess(false); |
| | | return result; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |