# 登录用户判断 成品计划添加计划开始 结束日期 过期判断
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | if(com == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该账户异常!"); |
| | | } |
| | | |
| | | if(com.getOepnValidDate().before(new Date())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过使用有效期!"); |
| | | } |
| | | //如果是企业用户 |
| | | QueryCompanyUserExtDTO c =new QueryCompanyUserExtDTO(); |
| | | c.setUserId(user.getId()); |
| | |
| | | c.setCompanyId(authenticationToken.getCompanyId()); |
| | | cu = companyUserExtService.selectOne(c); |
| | | if(cu == null){ |
| | | return null; |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户不存在!"); |
| | | } |
| | | if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户已禁用!"); |
| | |
| | | import java.text.DateFormatSymbols; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | |
| | | cal.add(Calendar.MINUTE,minutes); |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * LocalDateTime to date |
| | | * @param now |
| | | * @return |
| | | */ |
| | | public static LocalDateTime toDateLocalDateTime(Date now){ |
| | | return LocalDateTime.ofInstant(now.toInstant(), ZoneId.systemDefault()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * LocalDateTime to date |
| | | * @param localDateTime |
| | | * @return |
| | | */ |
| | | public static Date toDate(LocalDateTime localDateTime){ |
| | | Date from = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); |
| | | return from; |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "计划编码") |
| | | private String planCode; |
| | | |
| | | @ApiModelProperty(value = "计划日期") |
| | | @ApiModelProperty(value = "计划结束日期") |
| | | @Excel(name="计划日期",orderNum ="1",format = "yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date planDate; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | @ApiModelProperty(value = "销售单号" ) |
| | | @Excel(name="销售单号",index = 16,width =15) |
| | | private String salesorder; |
| | | @ApiModelProperty(value = "物料编码(关联material_distribute表)", example = "1") |
| | | private Integer materialId; |
| | |
| | | |
| | | @ApiModelProperty(value = "子计划明细信息", example = "1") |
| | | private List<PlansExtListVO> plansExtListVOList; |
| | | |
| | | @ApiModelProperty(value = "是否过期") |
| | | private Boolean hasExpire; |
| | | } |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | i.setFinishUnQualifiedNum(Objects.isNull(plansExtListVO.getUnqulifiedNum())?Constants.ZERO:plansExtListVO.getUnqulifiedNum()); |
| | | i.setFinishNum(Objects.isNull(plansExtListVO.getDoneNum())?Constants.ZERO:plansExtListVO.getDoneNum()); |
| | | } |
| | | if (Objects.nonNull(i.getPlanDate())){ |
| | | i.setHasExpire(DateUtil.toDateLocalDateTime(i.getPlanDate()).toLocalDate().isBefore(LocalDate.now())); |
| | | }else { |
| | | i.setHasExpire(false); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | return PageData.from(new PageInfo<>(result)); |