feat:预炸
This commit is contained in:
@@ -279,6 +279,7 @@ public enum ErrorCodeEnum {
|
|||||||
PRE_FRY_PRODUCT_NOT_EXIST(1511029,"预炸品不存在",null),
|
PRE_FRY_PRODUCT_NOT_EXIST(1511029,"预炸品不存在",null),
|
||||||
PRE_FRY_RECORD_EXIST(1511030,"当前门店已存在同类型预炸资质申请记录",null),
|
PRE_FRY_RECORD_EXIST(1511030,"当前门店已存在同类型预炸资质申请记录",null),
|
||||||
PRE_FRY_APPLY_NOT_EXIST(1511030,"预炸资质申请信息不存在",null),
|
PRE_FRY_APPLY_NOT_EXIST(1511030,"预炸资质申请信息不存在",null),
|
||||||
|
CURRENT_STAGE_NOT_OPERATION(1511030,"当前有更优选择,请确认!",null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预炸产品申请类型枚举
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 16:01
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public enum PreFryApplyTypeEnum {
|
||||||
|
HAS_REFRIGERATED_DISPLAY(1, "有冷藏展示柜"),
|
||||||
|
HAS_NORMAL_DISPLAY(2, "有常温展示柜"),
|
||||||
|
NO_DISPLAY(3, "无展示柜");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
PreFryApplyTypeEnum(int code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取枚举
|
||||||
|
*/
|
||||||
|
public static PreFryApplyTypeEnum getByCode(int code) {
|
||||||
|
for (PreFryApplyTypeEnum type : values()) {
|
||||||
|
if (type.code == code) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取描述
|
||||||
|
*/
|
||||||
|
public static String getDescriptionByCode(int code) {
|
||||||
|
PreFryApplyTypeEnum type = getByCode(code);
|
||||||
|
return type != null ? type.description : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 15:49
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public enum PreFryStageEnum {
|
||||||
|
PRE_FRY_COMPLETED(1, "预炸完成"),
|
||||||
|
STORED_IN_DISPLAY_CABINET(2, "存入展示柜"),
|
||||||
|
STORED_IN_FRIDGE(3, "放入冰箱"),
|
||||||
|
TAKEN_OUT_NEXT_DAY(4, "次日拿出"),
|
||||||
|
DISCARDED(5, "报废");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
PreFryStageEnum(int code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取枚举
|
||||||
|
*/
|
||||||
|
public static PreFryStageEnum getByCode(int code) {
|
||||||
|
for (PreFryStageEnum stage : values()) {
|
||||||
|
if (stage.code == code) {
|
||||||
|
return stage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据code获取描述
|
||||||
|
*/
|
||||||
|
public static String getDescriptionByCode(int code) {
|
||||||
|
PreFryStageEnum stage = getByCode(code);
|
||||||
|
return stage != null ? stage.description : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.entity.PreFryRecordsDO;
|
||||||
import com.cool.store.mapper.PreFryRecordsMapper;
|
import com.cool.store.mapper.PreFryRecordsMapper;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
@@ -16,9 +22,50 @@ public class PreFryRecordsDAO {
|
|||||||
@Resource
|
@Resource
|
||||||
private PreFryRecordsMapper preFryRecordsMapper;
|
private PreFryRecordsMapper preFryRecordsMapper;
|
||||||
|
|
||||||
|
public int insert(PreFryRecordsDO record) {
|
||||||
|
if (Objects.isNull(record)) {
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return preFryRecordsMapper.insertSelective(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int batchInsert(List<PreFryRecordsDO> records) {
|
||||||
|
if (CollectionUtils.isEmpty(records)) {
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return preFryRecordsMapper.batchInsert(records);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public PreFryRecordsDO queryById(Long id) {
|
||||||
|
if (id == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return preFryRecordsMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int batchUpdateStageByIds( List<Integer> ids,
|
||||||
|
Integer currentStage){
|
||||||
|
if (CollectionUtils.isEmpty(ids)) {
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return preFryRecordsMapper.batchUpdateStageByIds(ids,currentStage);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PreFryRecordsDO> selectByStoreAndDateStage(String storeCode,
|
||||||
|
List<Integer> yesterdayStageList,
|
||||||
|
Integer todayStage){
|
||||||
|
if (StringUtils.isBlank(storeCode) || CollectionUtils.isEmpty(yesterdayStageList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return preFryRecordsMapper.selectByStoreAndDateStage(storeCode,yesterdayStageList,todayStage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dto.pre.fry.PreFryStageImagesDTO;
|
||||||
|
import com.cool.store.entity.PreFryStageChangesDO;
|
||||||
import com.cool.store.mapper.PreFryStageChangesMapper;
|
import com.cool.store.mapper.PreFryStageChangesMapper;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
@@ -16,11 +23,20 @@ public class PreFryStageChangesDAO {
|
|||||||
@Resource
|
@Resource
|
||||||
PreFryStageChangesMapper preFryStageChangesMapper;
|
PreFryStageChangesMapper preFryStageChangesMapper;
|
||||||
|
|
||||||
|
public int batchInsert(List<PreFryStageChangesDO> records){
|
||||||
|
if (CollectionUtils.isEmpty(records)){
|
||||||
|
return CommonConstants.ZERO;
|
||||||
|
}
|
||||||
|
return preFryStageChangesMapper.batchInsert(records);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<PreFryStageImagesDTO> selectByRecordId( Integer recordId){
|
||||||
|
if (recordId == null){
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return preFryStageChangesMapper.selectByRecordId(recordId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
import com.cool.store.entity.PreFryRecordsDO;
|
import com.cool.store.entity.PreFryRecordsDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import tk.mybatis.mapper.common.Mapper;
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
|
public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
|
||||||
|
|
||||||
|
|
||||||
int batchInsert(List<PreFryRecordsDO> records);
|
int batchInsert(List<PreFryRecordsDO> records);
|
||||||
|
|
||||||
|
int batchUpdateStageByIds(@Param("ids") List<Integer> ids,
|
||||||
|
@Param("currentStage") Integer currentStage);
|
||||||
|
|
||||||
|
List<PreFryRecordsDO> selectByStoreAndDateStage(
|
||||||
|
@Param("storeCode") String storeCode,
|
||||||
|
@Param("yesterdayStageList") List<Integer> yesterdayStageList,
|
||||||
|
@Param("todayStage") Integer todayStage);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.pre.fry.PreFryStageImagesDTO;
|
||||||
import com.cool.store.entity.PreFryStageChangesDO;
|
import com.cool.store.entity.PreFryStageChangesDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import tk.mybatis.mapper.common.Mapper;
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface PreFryStageChangesMapper extends Mapper<PreFryStageChangesDO> {
|
public interface PreFryStageChangesMapper extends Mapper<PreFryStageChangesDO> {
|
||||||
|
|
||||||
|
|
||||||
|
int batchInsert(List<PreFryStageChangesDO> records);
|
||||||
|
|
||||||
|
List<PreFryStageImagesDTO> selectByRecordId(@Param("recordId") Integer recordId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,7 @@
|
|||||||
-->
|
-->
|
||||||
<id column="id" jdbcType="INTEGER" property="id" />
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
<result column="store_code" jdbcType="VARCHAR" property="storeCode" />
|
<result column="store_code" jdbcType="VARCHAR" property="storeCode" />
|
||||||
<result column="product_code" jdbcType="VARCHAR" property="productCode" />
|
<result column="product_code" jdbcType="INTEGER" property="productId" />
|
||||||
<result column="product_name" jdbcType="VARCHAR" property="productName" />
|
|
||||||
<result column="fry_date" jdbcType="DATE" property="fryDate" />
|
<result column="fry_date" jdbcType="DATE" property="fryDate" />
|
||||||
<result column="fry_complete_time" jdbcType="TIMESTAMP" property="fryCompleteTime" />
|
<result column="fry_complete_time" jdbcType="TIMESTAMP" property="fryCompleteTime" />
|
||||||
<result column="latest_sale_time" jdbcType="TIMESTAMP" property="latestSaleTime" />
|
<result column="latest_sale_time" jdbcType="TIMESTAMP" property="latestSaleTime" />
|
||||||
@@ -21,13 +20,40 @@
|
|||||||
|
|
||||||
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO xfsg_pre_fry_records
|
INSERT INTO xfsg_pre_fry_records
|
||||||
(store_code, product_code, product_name, fry_date, fry_complete_time,
|
(store_code, product_code, fry_date, fry_complete_time,
|
||||||
latest_sale_time, current_stage, current_apply_type, created_time, updated_time)
|
latest_sale_time, current_stage, current_apply_type, created_time, updated_time)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.storeCode}, #{item.productCode}, #{item.productName}, #{item.fryDate},
|
(#{item.storeCode}, #{item.productCode}, #{item.fryDate},
|
||||||
#{item.fryCompleteTime}, #{item.latestSaleTime}, #{item.currentStage},#{item.currentApplyType},
|
#{item.fryCompleteTime}, #{item.latestSaleTime}, #{item.currentStage},#{item.currentApplyType},
|
||||||
NOW(), NOW())
|
NOW(), NOW())
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="batchUpdateStageByIds">
|
||||||
|
UPDATE xfsg_pre_fry_records
|
||||||
|
SET current_stage = #{currentStage},
|
||||||
|
updated_time = NOW()
|
||||||
|
WHERE id IN
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByStoreAndDateStage" resultMap="BaseResultMap">
|
||||||
|
SELECT * FROM xfsg_pre_fry_records
|
||||||
|
WHERE store_code = #{storeCode}
|
||||||
|
AND (
|
||||||
|
(fry_date = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
|
||||||
|
AND current_stage IN
|
||||||
|
<foreach collection="yesterdayStageList" item="stage" open="(" separator="," close=")">
|
||||||
|
#{stage}
|
||||||
|
</foreach>)
|
||||||
|
OR
|
||||||
|
(fry_date = CURDATE() AND current_stage = #{todayStage})
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -15,4 +15,25 @@
|
|||||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
||||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
INSERT INTO xfsg_pre_fry_stage_changes
|
||||||
|
(record_id, stage, image1, image2, operator_name, remark, created_time, updated_time)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(#{item.recordId}, #{item.stage}, #{item.image1}, #{item.image2},
|
||||||
|
#{item.operatorName}, #{item.remark}, NOW(), NOW())
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectByRecordId" resultType="com.cool.store.dto.pre.fry.PreFryStageImagesDTO">
|
||||||
|
SELECT id, record_id, image1, image2, created_time
|
||||||
|
FROM xfsg_pre_fry_stage_changes
|
||||||
|
WHERE record_id = #{recordId}
|
||||||
|
ORDER BY created_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.cool.store.dto.pre.fry;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 14:58
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddPreFryRecordsDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("门店编码")
|
||||||
|
private String storeCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("当前产品阶段:1-预炸完成,2-存入展示柜,3-放入冰箱,4-次日拿出,5-报废")
|
||||||
|
private Integer currentStage;
|
||||||
|
|
||||||
|
@ApiModelProperty("申请类型 选择的类型 不是最高类型")
|
||||||
|
private Integer applyType;
|
||||||
|
|
||||||
|
@ApiModelProperty("批量数据")
|
||||||
|
private List<AddPreFryRecordsDetailDTO> records;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.cool.store.dto.pre.fry;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 14:55
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AddPreFryRecordsDetailDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("记录ID")
|
||||||
|
private Long recordId;
|
||||||
|
@ApiModelProperty("产品ID")
|
||||||
|
private Long productId;
|
||||||
|
@ApiModelProperty("图片1")
|
||||||
|
private String image1;
|
||||||
|
@ApiModelProperty("图片2")
|
||||||
|
private String image2;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.dto.pre.fry;
|
package com.cool.store.dto.pre.fry;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,6 +11,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class ApplyAuditDTO {
|
public class ApplyAuditDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("审核状态:1-通过,2-拒绝")
|
||||||
private Integer auditStatus;
|
private Integer auditStatus;
|
||||||
|
|
||||||
private String auditRemark;
|
private String auditRemark;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class ApplyManagementDTO {
|
|||||||
private String createUserMobile;
|
private String createUserMobile;
|
||||||
@ApiModelProperty("申请时间")
|
@ApiModelProperty("申请时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
@ApiModelProperty("状态 0 下架 1-上架")
|
@ApiModelProperty("审核状态:0-审批中,1-审核通过,2-审核不通过")
|
||||||
private Integer auditStatus;
|
private Integer auditStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.cool.store.dto.pre.fry;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.cool.store.dto.pre.fry;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 14:31
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PreFryStageImagesDTO {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private Integer recordId;
|
||||||
|
private String image1;
|
||||||
|
private String image2;
|
||||||
|
private Date createdTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,14 +21,9 @@ public class PreFryRecordsDO {
|
|||||||
/**
|
/**
|
||||||
* 预炸产品编码
|
* 预炸产品编码
|
||||||
*/
|
*/
|
||||||
@Column(name = "product_code")
|
@Column(name = "product_id")
|
||||||
private String productCode;
|
private Long productId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 预炸产品名称
|
|
||||||
*/
|
|
||||||
@Column(name = "product_name")
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预炸日期
|
* 预炸日期
|
||||||
@@ -72,6 +67,15 @@ public class PreFryRecordsDO {
|
|||||||
@Column(name = "updated_time")
|
@Column(name = "updated_time")
|
||||||
private Date updatedTime;
|
private Date updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getCurrentApplyType() {
|
||||||
|
return currentApplyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentApplyType(Integer currentApplyType) {
|
||||||
|
this.currentApplyType = currentApplyType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取主键ID
|
* 获取主键ID
|
||||||
*
|
*
|
||||||
@@ -111,38 +115,21 @@ public class PreFryRecordsDO {
|
|||||||
/**
|
/**
|
||||||
* 获取预炸产品编码
|
* 获取预炸产品编码
|
||||||
*
|
*
|
||||||
* @return product_code - 预炸产品编码
|
* @return product_id - 预炸产品编码
|
||||||
*/
|
*/
|
||||||
public String getProductCode() {
|
public Long getProductId() {
|
||||||
return productCode;
|
return productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置预炸产品编码
|
* 设置预炸产品编码
|
||||||
*
|
*
|
||||||
* @param productCode 预炸产品编码
|
* @param productId 预炸产品编码
|
||||||
*/
|
*/
|
||||||
public void setProductCode(String productCode) {
|
public void setProductId(Long productId) {
|
||||||
this.productCode = productCode;
|
this.productId = productId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取预炸产品名称
|
|
||||||
*
|
|
||||||
* @return product_name - 预炸产品名称
|
|
||||||
*/
|
|
||||||
public String getProductName() {
|
|
||||||
return productName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置预炸产品名称
|
|
||||||
*
|
|
||||||
* @param productName 预炸产品名称
|
|
||||||
*/
|
|
||||||
public void setProductName(String productName) {
|
|
||||||
this.productName = productName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取预炸日期
|
* 获取预炸日期
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.dto.pre.fry.AddPreFryRecordsDTO;
|
||||||
|
import com.cool.store.vo.PartnerUserInfoVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 14:39
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public interface PreFryRecordsService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量插入
|
||||||
|
* @param addPreFryRecordsDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean batchInsert(AddPreFryRecordsDTO addPreFryRecordsDTO, PartnerUserInfoVO user);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -58,7 +58,7 @@ public class PreFryQualificationApplyServiceImpl implements PreFryQualificationA
|
|||||||
PreFryQualificationApplyDO apply = createApplyRecord(request,user);
|
PreFryQualificationApplyDO apply = createApplyRecord(request,user);
|
||||||
|
|
||||||
// 4. 创建审批操作记录
|
// 4. 创建审批操作记录
|
||||||
createApprovalRecord(apply.getId(), AuditOperationTypeEnum.APPLY.getCode(), user.getUsername());
|
createApprovalRecord(apply.getId(), AuditOperationTypeEnum.APPLY.getCode(),1, user.getUsername(),"");
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
@@ -78,12 +78,13 @@ public class PreFryQualificationApplyServiceImpl implements PreFryQualificationA
|
|||||||
old.setColdStorageBoxPhoto(request.getColdStorageBoxPhoto());
|
old.setColdStorageBoxPhoto(request.getColdStorageBoxPhoto());
|
||||||
old.setProtectiveCoverPhoto(request.getProtectiveCoverPhoto());
|
old.setProtectiveCoverPhoto(request.getProtectiveCoverPhoto());
|
||||||
old.setRefrigeratorPlatePhoto(request.getRefrigeratorPlatePhoto());
|
old.setRefrigeratorPlatePhoto(request.getRefrigeratorPlatePhoto());
|
||||||
old.setColdStorageBoxPhoto(request.getColdStorageBoxPhoto());
|
old.setRefrigeratorPhoto(request.getRefrigeratorPhoto());
|
||||||
|
old.setAuditStatus(AuditStatusEnum.TODO.getCode());
|
||||||
old.setUpdatedTime(new Date());
|
old.setUpdatedTime(new Date());
|
||||||
|
|
||||||
preFryQualificationApplyDAO.updateForce(old);
|
preFryQualificationApplyDAO.updateForce(old);
|
||||||
// 4. 创建审批操作记录
|
// 4. 创建审批操作记录
|
||||||
createApprovalRecord(old.getId(), AuditOperationTypeEnum.APPLY.getCode(), user.getUsername());
|
createApprovalRecord(old.getId(), AuditOperationTypeEnum.APPLY.getCode(),1, user.getUsername(),"");
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
@@ -144,7 +145,7 @@ public class PreFryQualificationApplyServiceImpl implements PreFryQualificationA
|
|||||||
}
|
}
|
||||||
preFryQualificationApplyDO.setAuditStatus(applyAuditDTO.getAuditStatus());
|
preFryQualificationApplyDO.setAuditStatus(applyAuditDTO.getAuditStatus());
|
||||||
preFryQualificationApplyDAO.updateForce(preFryQualificationApplyDO);
|
preFryQualificationApplyDAO.updateForce(preFryQualificationApplyDO);
|
||||||
createApprovalRecord(applyAuditDTO.getId(),applyAuditDTO.getAuditStatus(),currentUser.getName());
|
createApprovalRecord(applyAuditDTO.getId(), 2,applyAuditDTO.getAuditStatus(),currentUser.getName(),applyAuditDTO.getAuditRemark());
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +184,6 @@ public class PreFryQualificationApplyServiceImpl implements PreFryQualificationA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PreFryQualificationApplyDO createApplyRecord(ApplyDTO request,PartnerUserInfoVO user) {
|
private PreFryQualificationApplyDO createApplyRecord(ApplyDTO request,PartnerUserInfoVO user) {
|
||||||
PreFryQualificationApplyDO apply = new PreFryQualificationApplyDO();
|
PreFryQualificationApplyDO apply = new PreFryQualificationApplyDO();
|
||||||
BeanUtils.copyProperties(request, apply);
|
BeanUtils.copyProperties(request, apply);
|
||||||
@@ -195,12 +195,13 @@ public class PreFryQualificationApplyServiceImpl implements PreFryQualificationA
|
|||||||
return apply;
|
return apply;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createApprovalRecord(Long applyId, Integer recordType,String userName) {
|
private void createApprovalRecord(Long applyId, Integer recordType,Integer operationStatus,String userName,String remark) {
|
||||||
PreFryApprovalRecordsDO record = new PreFryApprovalRecordsDO();
|
PreFryApprovalRecordsDO record = new PreFryApprovalRecordsDO();
|
||||||
record.setApplyId(applyId);
|
record.setApplyId(applyId);
|
||||||
record.setRecordType(recordType);
|
record.setRecordType(recordType);
|
||||||
record.setOperationStatus(CommonConstants.ONE);
|
record.setOperationStatus(operationStatus);
|
||||||
record.setOperatorName(userName);
|
record.setOperatorName(userName);
|
||||||
|
record.setRemark(remark);
|
||||||
record.setCreatedTime(new Date());
|
record.setCreatedTime(new Date());
|
||||||
preFryApprovalRecordsDAO.createApprovalRecord(record);
|
preFryApprovalRecordsDAO.createApprovalRecord(record);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.dao.PreFryQualificationApplyDAO;
|
||||||
|
import com.cool.store.dao.PreFryRecordsDAO;
|
||||||
|
import com.cool.store.dao.PreFryStageChangesDAO;
|
||||||
|
import com.cool.store.dto.pre.fry.AddPreFryRecordsDTO;
|
||||||
|
import com.cool.store.entity.PreFryQualificationApplyDO;
|
||||||
|
import com.cool.store.entity.PreFryRecordsDO;
|
||||||
|
import com.cool.store.entity.PreFryStageChangesDO;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.enums.PreFryApplyTypeEnum;
|
||||||
|
import com.cool.store.enums.PreFryStageEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.service.PreFryRecordsService;
|
||||||
|
import com.cool.store.vo.PartnerUserInfoVO;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/6/23 14:39
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PreFryRecordsServiceImpl implements PreFryRecordsService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PreFryRecordsDAO preFryRecordsDAO;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PreFryStageChangesDAO preFryStageChangesDAO;
|
||||||
|
@Resource
|
||||||
|
PreFryQualificationApplyDAO preFryQualificationApplyDAO;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean batchInsert(AddPreFryRecordsDTO addPreFryRecordsDTO, PartnerUserInfoVO user) {
|
||||||
|
if (CollectionUtils.isEmpty(addPreFryRecordsDTO.getRecords())|| CollectionUtils.isEmpty(addPreFryRecordsDTO.getRecords())){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
|
||||||
|
}
|
||||||
|
//查询门店当前最高优先级申请类型
|
||||||
|
PreFryQualificationApplyDO minApplyTypeByStoreCode = preFryQualificationApplyDAO.getMinApplyTypeByStoreCode(addPreFryRecordsDTO.getStoreCode());
|
||||||
|
if (minApplyTypeByStoreCode==null){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.PRE_FRY_APPLY_NOT_EXIST);
|
||||||
|
}
|
||||||
|
//如果出现优先级升高的情况 优先级低的只有报废可选择 1的优先级最高 3最低
|
||||||
|
if (minApplyTypeByStoreCode.getApplyType()<addPreFryRecordsDTO.getApplyType()
|
||||||
|
&&addPreFryRecordsDTO.getCurrentStage()!= PreFryStageEnum.DISCARDED.getCode()){
|
||||||
|
//当前有更优选择,请确认
|
||||||
|
throw new ServiceException(ErrorCodeEnum.CURRENT_STAGE_NOT_OPERATION);
|
||||||
|
}
|
||||||
|
//只有当最高类型是1/3且是预炸完成 或者 2 且放入展示柜 新增一条预炸记录 其他情况只新增阶段记录表
|
||||||
|
List<PreFryStageChangesDO> list = new ArrayList<>();
|
||||||
|
if (addPreFryRecordsFlag(minApplyTypeByStoreCode.getApplyType(), addPreFryRecordsDTO.getCurrentStage())){
|
||||||
|
addPreFryRecordsDTO.getRecords().forEach(x->{
|
||||||
|
PreFryRecordsDO preFryRecordsDO = new PreFryRecordsDO();
|
||||||
|
preFryRecordsDO.setProductId(x.getProductId());
|
||||||
|
preFryRecordsDO.setFryDate(new Date());
|
||||||
|
preFryRecordsDO.setFryCompleteTime(new Date());
|
||||||
|
preFryRecordsDO.setLatestSaleTime(getLatestSaleTime(minApplyTypeByStoreCode.getApplyType()));
|
||||||
|
preFryRecordsDO.setCurrentStage(addPreFryRecordsDTO.getCurrentStage());
|
||||||
|
preFryRecordsDO.setCurrentApplyType(minApplyTypeByStoreCode.getApplyType());
|
||||||
|
preFryRecordsDAO.insert(preFryRecordsDO);
|
||||||
|
PreFryStageChangesDO preFryStageChangesDO = new PreFryStageChangesDO();
|
||||||
|
preFryStageChangesDO.setStage(preFryRecordsDO.getCurrentStage());
|
||||||
|
preFryStageChangesDO.setRecordId(preFryRecordsDO.getId());
|
||||||
|
preFryStageChangesDO.setImage1(x.getImage1());
|
||||||
|
preFryStageChangesDO.setImage2(x.getImage2());
|
||||||
|
preFryStageChangesDO.setOperatorName(user.getUsername());
|
||||||
|
list.add(preFryStageChangesDO);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
addPreFryRecordsDTO.getRecords().forEach(x->{
|
||||||
|
PreFryStageChangesDO preFryStageChangesDO = new PreFryStageChangesDO();
|
||||||
|
preFryStageChangesDO.setStage(addPreFryRecordsDTO.getCurrentStage());
|
||||||
|
preFryStageChangesDO.setRecordId(x.getRecordId());
|
||||||
|
preFryStageChangesDO.setImage1(x.getImage1());
|
||||||
|
preFryStageChangesDO.setImage2(x.getImage2());
|
||||||
|
preFryStageChangesDO.setOperatorName(user.getUsername());
|
||||||
|
list.add(preFryStageChangesDO);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
preFryStageChangesDAO.batchInsert(list);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Boolean addPreFryRecordsFlag(Integer applyType,Integer stage){
|
||||||
|
if (applyType== PreFryApplyTypeEnum.HAS_REFRIGERATED_DISPLAY.getCode() && stage==PreFryStageEnum.PRE_FRY_COMPLETED.getCode()){
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}else if (applyType == PreFryApplyTypeEnum.NO_DISPLAY.getCode() && stage==PreFryStageEnum.PRE_FRY_COMPLETED.getCode()){
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
if (applyType==PreFryApplyTypeEnum.HAS_NORMAL_DISPLAY.getCode() && stage==PreFryStageEnum.STORED_IN_DISPLAY_CABINET.getCode()){
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date getLatestSaleTime(Integer applyType) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
if (applyType == PreFryApplyTypeEnum.HAS_REFRIGERATED_DISPLAY.getCode()) {
|
||||||
|
// 冷藏展示柜加12小时
|
||||||
|
calendar.add(Calendar.HOUR_OF_DAY, 12);
|
||||||
|
} else {
|
||||||
|
// 常温展示柜或无展示柜加4小时
|
||||||
|
calendar.add(Calendar.HOUR_OF_DAY, 4);
|
||||||
|
}
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
@@ -36,6 +37,13 @@ public class PreFryQualificationApplyController {
|
|||||||
return ResponseResult.success(preFryQualificationApplyService.queryApplyManagementList( dto));
|
return ResponseResult.success(preFryQualificationApplyService.queryApplyManagementList( dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据申请ID获取审批记录列表")
|
||||||
|
@GetMapping("/getApprovalRecordById")
|
||||||
|
public ResponseResult<List<ApprovalRecordDTO>> getApprovalRecordById(@RequestParam(required = true, value = "id") Long id) {
|
||||||
|
log.info("根据申请ID获取审批记录列表:{}", JSONObject.toJSONString(id));
|
||||||
|
return ResponseResult.success(preFryQualificationApplyService.getApprovalRecordById(id));
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("预炸资质申请详情")
|
@ApiOperation("预炸资质申请详情")
|
||||||
@GetMapping("/getApplyDetail")
|
@GetMapping("/getApplyDetail")
|
||||||
public ResponseResult<ApplyDetailDTO> getApplyDetail(@RequestParam(required = true, value = "id") Long id) {
|
public ResponseResult<ApplyDetailDTO> getApplyDetail(@RequestParam(required = true, value = "id") Long id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user