jiangping
2023-08-11 8d582affc8f34e5074c0a0cadeec669d21050fcf
修改成品计划上传逻辑,新增开始日期和销售单号数据
已修改4个文件
43 ■■■■■ 文件已修改
server/src/main/java/doumeemes/config/shiro/ShiroRealm.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/core/utils/DateUtil.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/dao/business/vo/WorkPlansVO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/src/main/java/doumeemes/config/shiro/ShiroRealm.java
@@ -35,6 +35,7 @@
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
/**
@@ -129,6 +130,10 @@
            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());
@@ -136,7 +141,7 @@
            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(),"对不起,该企业用户已禁用!");
server/src/main/java/doumeemes/core/utils/DateUtil.java
@@ -10,6 +10,8 @@
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.*;
@@ -3002,4 +3004,25 @@
        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;
    }
}
server/src/main/java/doumeemes/dao/business/vo/WorkPlansVO.java
@@ -76,7 +76,6 @@
    @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;
@@ -153,4 +152,7 @@
    @ApiModelProperty(value = "子计划明细信息", example = "1")
    private List<PlansExtListVO> plansExtListVOList;
    @ApiModelProperty(value = "是否过期")
    private Boolean hasExpire;
}
server/src/main/java/doumeemes/service/ext/impl/WorkPlansExtServiceImpl.java
@@ -32,6 +32,7 @@
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;
@@ -172,6 +173,12 @@
                    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));