模板接口

This commit is contained in:
苏竹红
2024-04-25 14:08:56 +08:00
parent 0615d948cb
commit c58f85abeb
9 changed files with 216 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
package com.cool.store.dao;
import com.cool.store.entity.AssessmentTemplateDO;
import com.cool.store.mapper.AssessmentTemplateMapper;
import com.google.common.collect.Lists;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/4/25 11:20
* @Version 1.0
*/
@Repository
public class AssessmentTemplateDAO {
@Resource
private AssessmentTemplateMapper assessmentTemplateMapper;
public List<AssessmentTemplateDO> listByType(@Param("type") Integer type){
if (type == null){
return Lists.newArrayList();
}
return assessmentTemplateMapper.listByType(type);
}
}

View File

@@ -1,7 +1,20 @@
package com.cool.store.mapper; package com.cool.store.mapper;
import com.cool.store.entity.AssessmentTemplateDO; import com.cool.store.entity.AssessmentTemplateDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface AssessmentTemplateMapper extends Mapper<AssessmentTemplateDO> { public interface AssessmentTemplateMapper extends Mapper<AssessmentTemplateDO> {
/**
* 根据类型查询
* @param type
* @return
*/
List<AssessmentTemplateDO> listByType(@Param("type") Integer type);
} }

View File

@@ -13,4 +13,9 @@
<result column="score" jdbcType="BIGINT" property="score" /> <result column="score" jdbcType="BIGINT" property="score" />
<result column="template_requirements" jdbcType="LONGVARCHAR" property="templateRequirements" /> <result column="template_requirements" jdbcType="LONGVARCHAR" property="templateRequirements" />
</resultMap> </resultMap>
<select id="listByType" resultMap="BaseResultMap">
select * from xfsg_assessment_template where type = #{type}
</select>
</mapper> </mapper>

View File

@@ -11,7 +11,7 @@ public class AssessmentTemplateDO {
/** /**
* 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收 * 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收
*/ */
private Boolean type; private Integer type;
/** /**
* 模板类别,可为空 * 模板类别,可为空
@@ -60,7 +60,7 @@ public class AssessmentTemplateDO {
* *
* @return type - 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收 * @return type - 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收
*/ */
public Boolean getType() { public Integer getType() {
return type; return type;
} }
@@ -69,7 +69,7 @@ public class AssessmentTemplateDO {
* *
* @param type 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收 * @param type 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收
*/ */
public void setType(Boolean type) { public void setType(Integer type) {
this.type = type; this.type = type;
} }

View File

@@ -0,0 +1,56 @@
package com.cool.store.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/4/25 11:26
* @Version 1.0
*/
@Data
public class AssessmentTemplateVO {
@ApiModelProperty("ID")
private Long id;
/**
* 模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收
*/
@ApiModelProperty("模板类型0 - 教练员, 1 - 店长, 2 - 店员, 3 - 三方验收")
private Integer type;
/**
* 模板类别,可为空
*/
@ApiModelProperty("分类")
private String category;
/**
* 模板名称
*/
@ApiModelProperty("模板名称")
private String templateName;
/**
* 模板remark
*/
@ApiModelProperty("模板remark")
private List<String> templateRemarkList;
/**
* 考核项分值
*/
@ApiModelProperty("考核项分值")
private Long score;
/**
* 模板要求明细,包括详细的考核要求描述
*/
@ApiModelProperty("模板要求明细,包括详细的考核要求描述")
private String templateRequirements;
}

View File

@@ -0,0 +1,25 @@
package com.cool.store.service;
import com.cool.store.vo.AssessmentTemplateVO;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/4/25 11:24
* @Version 1.0
*/
public interface AssessmentTemplateService {
/**
* listByType
* @Description
* @Author suzhuhong
* @Date 2024/4/25 11:24
* @param type
* @return
*/
List<AssessmentTemplateVO> listByType(Integer type);
}

View File

@@ -0,0 +1,44 @@
package com.cool.store.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.AssessmentTemplateDAO;
import com.cool.store.entity.AssessmentTemplateDO;
import com.cool.store.service.AssessmentTemplateService;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.AssessmentTemplateVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/4/25 11:25
* @Version 1.0
*/
@Service
public class AssessmentTemplateServiceImpl implements AssessmentTemplateService {
@Resource
AssessmentTemplateDAO assessmentTemplateDAO;
@Override
public List<AssessmentTemplateVO> listByType(Integer type) {
List<AssessmentTemplateDO> assessmentTemplateDOS = assessmentTemplateDAO.listByType(type);
List<AssessmentTemplateVO> result = new ArrayList<>();
assessmentTemplateDOS.forEach(x->{
AssessmentTemplateVO assessmentTemplateVO = new AssessmentTemplateVO();
BeanUtil.copyProperties(x,assessmentTemplateVO);
x.getTemplateRemark();
if (StringUtils.isNotEmpty(x.getTemplateRemark())){
String[] split = x.getTemplateRemark().replaceAll("[\\[\\]\\s]", "").split(",");
assessmentTemplateVO.setTemplateRemarkList(Arrays.asList(split));
}
result.add(assessmentTemplateVO);
});
return result;
}
}

View File

@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
* @Version 1.0 * @Version 1.0
*/ */
@Service @Service
public class PreparationServiceImpl implements PreparationService { public class PreparationServiceImpl implements PreparationService {
@Resource @Resource
private ShopStageInfoDAO shopStageInfoDAO; private ShopStageInfoDAO shopStageInfoDAO;
@@ -38,8 +38,8 @@ public class PreparationServiceImpl implements PreparationService {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null); List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
if (CollectionUtils.isNotEmpty(shopStageInfo)){ if (CollectionUtils.isNotEmpty(shopStageInfo)){
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data)); Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean buildStoreCompletionFlag= ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatusName().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_3.getShopSubStage()).getShopSubStageStatus()); Boolean buildStoreCompletionFlag= ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_3.getShopSubStage()).getShopSubStageStatus());
Boolean contractCompletionFlag= ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatusName().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage()).getShopSubStageStatus()); Boolean contractCompletionFlag= ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_73.getShopSubStageStatus().equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_7.getShopSubStage()).getShopSubStageStatus());
//都完成了 初始化后续流程数据 //都完成了 初始化后续流程数据
if (buildStoreCompletionFlag && contractCompletionFlag){ if (buildStoreCompletionFlag && contractCompletionFlag){

View File

@@ -0,0 +1,39 @@
package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.AssessmentTemplateService;
import com.cool.store.vo.AssessmentTemplateVO;
import com.cool.store.vo.desk.IntendPendingVO;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2024/4/25 11:41
* @Version 1.0
*/
@Api(tags = "模板列表")
@RestController
@RequestMapping("pc/template")
public class AssessmentTemplateController {
@Resource
AssessmentTemplateService assessmentTemplateService;
@ApiOperation("检查项模板列表type 0 1 2 3")
@GetMapping("/listByType")
public ResponseResult<List<AssessmentTemplateVO>> intendPendingList(@RequestParam(value = "type",required = true)Integer type) {
return ResponseResult.success(assessmentTemplateService.listByType(type));
}
}