开业筹备阶段3.0

This commit is contained in:
shuo.wang
2024-04-26 02:26:15 +08:00
parent 1d274bfe55
commit 1eef5980e7
20 changed files with 115 additions and 117 deletions

View File

@@ -1,7 +1,7 @@
package com.cool.store.dao; package com.cool.store.dao;
import com.cool.store.constants.CommonConstants; import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.openPreparation.UserInfoDTO; import com.cool.store.dto.openPreparation.UserNameDTO;
import com.cool.store.entity.EnterpriseUserDO; import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.mapper.EnterpriseUserMapper; import com.cool.store.mapper.EnterpriseUserMapper;
import com.cool.store.utils.StringUtil; import com.cool.store.utils.StringUtil;
@@ -125,7 +125,7 @@ public class EnterpriseUserDAO {
} }
return enterpriseUserMapper.selectByInvestmentManager( investmentManager); return enterpriseUserMapper.selectByInvestmentManager( investmentManager);
} }
public List<UserInfoDTO> getNameByUserId(List<String> userIdList){ public List<UserNameDTO> getNameByUserId(List<String> userIdList){
return enterpriseUserMapper.selectNameByUserId(userIdList); return enterpriseUserMapper.selectNameByUserId(userIdList);
} }
} }

View File

@@ -8,6 +8,7 @@ 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.Date;
import java.util.List; import java.util.List;
/** /**
@@ -29,17 +30,21 @@ public class OpeningOperationPlanDAO {
} }
public Integer updateResultType(Long shopId,Long auditId,Integer resultType){
return openingOperationPlanMapper.updateByShopId(shopId,auditId,resultType);
}
public Long updateSelective( OpeningOperationPlanDO openingOperationPlanDO){ public Long updateSelective( OpeningOperationPlanDO openingOperationPlanDO){
openingOperationPlanMapper.updateByPrimaryKeySelective(openingOperationPlanDO); openingOperationPlanMapper.updateByPrimaryKeySelective(openingOperationPlanDO);
return openingOperationPlanDO.getId(); return openingOperationPlanDO.getId();
} }
public OpeningOperationPlanDO selectByShopId( Long shopId){ public OpeningOperationPlanDO selectByShopId( Long shopId){
return openingOperationPlanMapper.selectByShopId(shopId); return openingOperationPlanMapper.selectByShopId(shopId);
} }
//条件关联查询
public List<OpeningOperationPlanDTO> selectConditionPlanList( OpeningOperationPlanDTO openingOperationPlanDTO){ public List<OpeningOperationPlanDTO> selectConditionPlanList(Date StartDate,Date EndDate,Integer resultType){
return openingOperationPlanMapper.selectPlanListByShopId( openingOperationPlanDTO); return openingOperationPlanMapper.selectPlanList( StartDate,EndDate,resultType);
} }
} }

View File

@@ -1,6 +1,6 @@
package com.cool.store.mapper; package com.cool.store.mapper;
import com.cool.store.dto.openPreparation.UserInfoDTO; import com.cool.store.dto.openPreparation.UserNameDTO;
import com.cool.store.entity.EnterpriseUserDO; import com.cool.store.entity.EnterpriseUserDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -75,5 +75,5 @@ public interface EnterpriseUserMapper {
* @Date: 2024/4/24 * @Date: 2024/4/24
* @description: 根据userid查询名字 * @description: 根据userid查询名字
*/ */
List<UserInfoDTO> selectNameByUserId(@Param("userIdList") List<String> userId); List<UserNameDTO> selectNameByUserId(@Param("userIdList") List<String> userId);
} }

View File

@@ -5,12 +5,16 @@ import com.cool.store.entity.OpeningOperationPlanDO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List; import java.util.List;
public interface OpeningOperationPlanMapper extends Mapper<OpeningOperationPlanDO> { public interface OpeningOperationPlanMapper extends Mapper<OpeningOperationPlanDO> {
OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId); OpeningOperationPlanDO selectByShopId(@Param("shopId") Long shopId);
List<OpeningOperationPlanDTO> selectPlanListByShopId(@Param("openingOperationPlanDTO") OpeningOperationPlanDTO openingOperationPlanDTO ); List<OpeningOperationPlanDTO> selectPlanList( @Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("resultType") Integer resultType);
Integer updateByShopId(@Param("shopId") Long shopId, @Param("audit") Long auditId, @Param("resulType") Integer resultType);
} }

View File

@@ -7,18 +7,19 @@ import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
public interface ShopAuditInfoMapper extends Mapper<ShopAuditInfoDO> { public interface ShopAuditInfoMapper extends Mapper<ShopAuditInfoDO> {
ShopAuditInfoDO selectBykeyAndType(@Param("shopId") Long shopId); ShopAuditInfoDO selectBykeyAndType(@Param("shopId") Long shopId);
List<ShopAuditInfoDO> getAuditInfoList(@Param("auditIds") List<Long> auditIds); List<ShopAuditInfoDO> getAuditInfoList(@Param("auditIds") List<Long> auditIds);
List<ShopAuditInfoDO> getListByShopIdAndType(@Param("shopId") Long shopId, List<ShopAuditInfoDO> getListByShopIdAndType(@Param("shopId") Long shopId,
@Param("type") Integer type); @Param("type") Integer type);
/** /**
* @Auther: wangshuo * @Auther: wangshuo
* @Date: 2024/4/23 * @Date: 2024/4/23
* @description:根据店铺id查询审批结果 * @description:根据店铺id查询审批结果
*/ */
Long selectAuditIdByShopId(@Param("shopId") Long shopId); Long selectAuditIdByShopId(@Param("shopId") Long shopId);
} }

View File

@@ -132,7 +132,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM enterprise_user_${enterpriseId} WHERE ( mobile = #{investmentManager} or `name` = #{investmentManager} ) and active = true LIMIT 1 FROM enterprise_user_${enterpriseId} WHERE ( mobile = #{investmentManager} or `name` = #{investmentManager} ) and active = true LIMIT 1
</select> </select>
<select id="selectNameByUserId" resultType="com.cool.store.dto.openPreparation.UserInfoDTO"> <select id="selectNameByUserId" resultType="com.cool.store.dto.openPreparation.UserNameDTO">
select user_id as userId ,name , select user_id as userId ,name ,
from enterprise_user_${enterpriseId} from enterprise_user_${enterpriseId}
where user_id in where user_id in

View File

@@ -28,6 +28,11 @@
shop_id,plan_source,submitted_user_id,submission_time,survey_result,survey_result_url,activity_theme,activity_theme_url,preparation_user_ids, shop_id,plan_source,submitted_user_id,submission_time,survey_result,survey_result_url,activity_theme,activity_theme_url,preparation_user_ids,
route_completed,deleted,audit_id,result_type route_completed,deleted,audit_id,result_type
</sql> </sql>
<update id="updateByShopId">
update xfsg_opening_operation_plan
set audit_id = #{auditId},result_type = #{resultType}
where shop_id = #{shopId}
</update>
<select id="selectByShopId" resultType="com.cool.store.entity.OpeningOperationPlanDO"> <select id="selectByShopId" resultType="com.cool.store.entity.OpeningOperationPlanDO">
select select
@@ -38,19 +43,19 @@
and and
deleted = 0 deleted = 0
</select> </select>
<select id="selectPlanListByShopId" resultType="com.cool.store.dto.openPreparation.OpeningOperationPlanDTO"> <select id="selectPlanList" resultType="com.cool.store.dto.openPreparation.OpeningOperationPlanDTO">
SELECT op.shop_id AS shopId, op.update_time AS updateTime, op.result_type AS resultType SELECT op.shop_id AS shopId, op.submission_time AS submissionTime, op.result_type AS resultType
op.audit_id as auditId
FROM xfsg_opening_operation_plan op FROM xfsg_opening_operation_plan op
JOIN xfsg_shop_info si ON op.shop_id = si.id
where where
<if test="openingOperationPlanDTO.planStartDate != null"> <if test="openingOperationPlanDTO.planStartDate != null">
op.create_time >= #{openingOperationPlanDTO.planStartDate} op.create_time >= #{startDate}
</if> </if>
<if test="openingOperationPlanDTO.planEndDate != null"> <if test="openingOperationPlanDTO.planEndDate != null">
<![CDATA[AND op.create_time <= #{openingOperationPlanDTO.planEndDate}]]> <![CDATA[AND op.create_time <= #{endDate}]]>
</if> </if>
<if test="openingOperationPlanDTO.resultType != null"> <if test="openingOperationPlanDTO.resultType != null">
and op.result_type = #{openingOperationPlanDTO.resultType} and op.result_type = #{resultType}
</if> </if>
</select> </select>

View File

@@ -2,8 +2,6 @@ package com.cool.store.dto.openPreparation;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.time.LocalDate;
import java.util.Date; import java.util.Date;
/** /**
@@ -33,12 +31,10 @@ public class OpeningOperationPlanDTO {
@ApiModelProperty("审核结果,0待审核1通过2拒绝") @ApiModelProperty("审核结果,0待审核1通过2拒绝")
private Integer resultType; private Integer resultType;
@ApiModelProperty("起始日期") @ApiModelProperty("更新时间")
public Date planStartDate; private Date updateTime;
@ApiModelProperty("结束日期")
public Date planEndDate;
private Long auditId;

View File

@@ -10,7 +10,7 @@ import lombok.Data;
*/ */
@Data @Data
public class UserInfoDTO { public class UserNameDTO {
private Long userId; private Long userId;

View File

@@ -109,6 +109,9 @@ public class OpeningOperationPlanDO {
@Column(name = "result_type") @Column(name = "result_type")
private Integer resultType; private Integer resultType;
public Integer getResultType() { public Integer getResultType() {
return resultType; return resultType;
} }
@@ -117,14 +120,6 @@ public class OpeningOperationPlanDO {
this.resultType = resultType; this.resultType = resultType;
} }
/** /**
* @return id * @return id
*/ */

View File

@@ -1,6 +1,7 @@
package com.cool.store.request; package com.cool.store.request;
import com.cool.store.entity.ShopAuditInfoDO; import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditTypeEnum;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -15,21 +16,9 @@ import java.util.Date;
@Data @Data
public class OpeningOperationPlanAuditRequest { public class OpeningOperationPlanAuditRequest {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("店铺id") @ApiModelProperty("店铺id")
private Long shopId; private Long shopId;
@ApiModelProperty("2-开业运营方案")
private Integer auditType;
@ApiModelProperty("提交人ID")
private String submittedUserId;
@ApiModelProperty("提交人名称")
private String submittedUserName;
@ApiModelProperty("结果类型 0通过,1拒绝") @ApiModelProperty("结果类型 0通过,1拒绝")
private Integer resultType; private Integer resultType;
@@ -39,20 +28,15 @@ public class OpeningOperationPlanAuditRequest {
@ApiModelProperty("拒绝原因") @ApiModelProperty("拒绝原因")
private String rejectReason; private String rejectReason;
@ApiModelProperty("是否删除0.否 1.是")
private Boolean deleted;
public ShopAuditInfoDO toShopAuditInfoDO() { public ShopAuditInfoDO toShopAuditInfoDO() {
ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO(); ShopAuditInfoDO shopAuditInfoDO = new ShopAuditInfoDO();
shopAuditInfoDO.setId(id);
shopAuditInfoDO.setShopId(shopId); shopAuditInfoDO.setShopId(shopId);
shopAuditInfoDO.setAuditType(auditType); shopAuditInfoDO.setAuditType(AuditTypeEnum.OPENING_OPERATION_PLAN.getCode());
shopAuditInfoDO.setResultType(resultType); shopAuditInfoDO.setResultType(resultType);
if (resultType == 0 )
shopAuditInfoDO.setPassReason(passReason); shopAuditInfoDO.setPassReason(passReason);
else
shopAuditInfoDO.setRejectReason(rejectReason); shopAuditInfoDO.setRejectReason(rejectReason);
shopAuditInfoDO.setDeleted(deleted);
shopAuditInfoDO.setSubmittedUserId(submittedUserId);
shopAuditInfoDO.setSubmittedUserName(submittedUserName);
shopAuditInfoDO.setCreateTime(new Date()); shopAuditInfoDO.setCreateTime(new Date());
shopAuditInfoDO.setUpdateTime(new Date()); shopAuditInfoDO.setUpdateTime(new Date());
return shopAuditInfoDO; return shopAuditInfoDO;

View File

@@ -13,8 +13,6 @@ import lombok.Data;
@Data @Data
public class OpeningOperationPlanRequest { public class OpeningOperationPlanRequest {
@ApiModelProperty("id")
private Long id;
@ApiModelProperty("店铺id") @ApiModelProperty("店铺id")
private Long shopId; private Long shopId;
@@ -40,12 +38,6 @@ public class OpeningOperationPlanRequest {
@ApiModelProperty("是否完成排车路线") @ApiModelProperty("是否完成排车路线")
private Byte routeCompleted; private Byte routeCompleted;
@ApiModelProperty("是否删除0.否 1.是")
private Boolean deleted;
@ApiModelProperty("审核结果,0待审核1通过2拒绝")
private Integer resultType;
public OpeningOperationPlanDO toOpeningOperationPlanDO() { public OpeningOperationPlanDO toOpeningOperationPlanDO() {
@@ -58,8 +50,6 @@ public class OpeningOperationPlanRequest {
openingOperationPlanDO.setActivityThemeUrl(activityThemeUrl); openingOperationPlanDO.setActivityThemeUrl(activityThemeUrl);
openingOperationPlanDO.setPreparationUserIds(preparationUserIds); openingOperationPlanDO.setPreparationUserIds(preparationUserIds);
openingOperationPlanDO.setRouteCompleted(routeCompleted); openingOperationPlanDO.setRouteCompleted(routeCompleted);
openingOperationPlanDO.setDeleted(deleted);
openingOperationPlanDO.setResultType(resultType);
return openingOperationPlanDO; return openingOperationPlanDO;
} }
} }

View File

@@ -9,11 +9,14 @@ import java.util.Date;
* @Auther: WangShuo * @Auther: WangShuo
* @Date: 2024/04/23/上午10:47 * @Date: 2024/04/23/上午10:47
* @Version 1.0 * @Version 1.0
* @注释: * @注释: 运营方案审核
*/ */
@Data @Data
public class OpeningOperationPlanListVO { public class OpeningOperationPlanListVO {
@ApiModelProperty("方案关联审核id")
private Long auditId;
@ApiModelProperty("门店id") @ApiModelProperty("门店id")
private Long shopId; private Long shopId;

View File

@@ -26,7 +26,7 @@ public class OpeningOperationPlanVO {
@ApiModelProperty("活动主题url") @ApiModelProperty("活动主题url")
private String activityThemeUrl; private String activityThemeUrl;
@ApiModelProperty("筹备人员ids") @ApiModelProperty("筹备人员name")
private String preparationUsers; private String preparationUsers;
@ApiModelProperty("是否完成排车路线") @ApiModelProperty("是否完成排车路线")

View File

@@ -2,6 +2,7 @@ package com.cool.store.service;
import com.cool.store.dto.openPreparation.FirstOrderDTO; import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.FirstOrderDO; import com.cool.store.entity.FirstOrderDO;
import com.cool.store.request.FirstOrderRequest;
/** /**
* @Auther: WangShuo * @Auther: WangShuo
@@ -11,7 +12,7 @@ import com.cool.store.entity.FirstOrderDO;
*/ */
public interface FirstOrderService { public interface FirstOrderService {
Integer saveOrder(FirstOrderDO order); Integer saveOrder(FirstOrderRequest request);
FirstOrderDTO getOrder(Long shopId); FirstOrderDTO getOrder(Long shopId);
} }

View File

@@ -16,16 +16,19 @@ import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.mq.util.HttpRestTemplateService; import com.cool.store.mq.util.HttpRestTemplateService;
import com.cool.store.request.FirstOrderRequest;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.service.CoolStoreStartFlowService; import com.cool.store.service.CoolStoreStartFlowService;
import com.cool.store.service.FirstOrderService; import com.cool.store.service.FirstOrderService;
import com.cool.store.service.PreparationService; import com.cool.store.service.PreparationService;
import com.cool.store.service.ShopService; import com.cool.store.service.ShopService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.Date; import java.util.Date;
@@ -57,8 +60,16 @@ public class FirstOrderServiceImp implements FirstOrderService {
private CoolStoreStartFlowService coolStoreStartFlowService; private CoolStoreStartFlowService coolStoreStartFlowService;
@Override @Override
public Integer saveOrder(FirstOrderDO order) { public Integer saveOrder(FirstOrderRequest request) {
String userId = CurrentUserHolder.getUserId(); String userId = CurrentUserHolder.getUserId();
FirstOrderDO order = new FirstOrderDO();
try {
BeanUtils.copyProperties(order, request);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
log.info("save order:{}", JSONObject.toJSONString(order)); log.info("save order:{}", JSONObject.toJSONString(order));
if (order == null) { if (order == null) {
throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL); throw new ServiceException(ErrorCodeEnum.FIRST_ORDER_PARAM_NULL);

View File

@@ -1,13 +1,13 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder; import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dao.OpeningOperationPlanAuditDAO; import com.cool.store.dao.*;
import com.cool.store.dao.OpeningOperationPlanDAO; import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.dao.ShopAuditInfoDAO;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.entity.OpeningOperationPlanDO; import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.entity.ShopAuditInfoDO; import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditTypeEnum;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.OpeningOperationPlanResultTypeEnum; import com.cool.store.enums.OpeningOperationPlanResultTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -41,36 +41,40 @@ public class OpeningOperationPlanAuditImpl implements OpeningOperationPlanAuditS
private ShopStageInfoDAO shopStageInfoDAO; private ShopStageInfoDAO shopStageInfoDAO;
@Resource @Resource
private PreparationService preparationService; private PreparationService preparationService;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Override @Override
public Long addNewPlanAudit(OpeningOperationPlanAuditRequest request) { public Long addNewPlanAudit(OpeningOperationPlanAuditRequest request) {
log.info("addNewPlanAudit request:{}", request); log.info("addNewPlanAudit request:{}", JSONObject.toJSONString(request));
String userId = CurrentUserHolder.getUserId();
ShopAuditInfoDO shopAuditInfoDO = request.toShopAuditInfoDO(); ShopAuditInfoDO shopAuditInfoDO = request.toShopAuditInfoDO();
EnterpriseUserDO userInfoById = enterpriseUserDAO.getUserInfoById(userId);
shopAuditInfoDO.setSubmittedUserId(userId);
shopAuditInfoDO.setSubmittedUserName(userInfoById.getName());
shopAuditInfoDO.setAuditType(AuditTypeEnum.OPENING_OPERATION_PLAN.getCode());
return openingOperationPlanAuditDAO.insertSelective(shopAuditInfoDO); return openingOperationPlanAuditDAO.insertSelective(shopAuditInfoDO);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean auditPlan(OpeningOperationPlanAuditRequest request) { public Boolean auditPlan(OpeningOperationPlanAuditRequest request) {
log.info("auditPlan request:{}", request); log.info("auditPlan request:{}", JSONObject.toJSONString(request));
if (Objects.isNull(request.getId())) { if (Objects.isNull(request)) {
log.error("auditPlan request id is null"); log.error("auditPlan request is null");
throw new ServiceException("auditPlan request id is null"); throw new ServiceException("auditPlan request is null");
} }
String userId = CurrentUserHolder.getUserId(); String userId = CurrentUserHolder.getUserId();
try { try {
Integer audit = openingOperationPlanAuditDAO.updateSelective(request.toShopAuditInfoDO()); Long auditId = openingOperationPlanAuditDAO.insertSelective(request.toShopAuditInfoDO());
if (Objects.isNull(audit)) { if (Objects.isNull(auditId)) {
log.error("auditPlan audit is null"); log.error("auditPlan audit is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_AUDIT_PLAN_FALSE); throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE);
} }
Long auditId = openingOperationPlanAuditDAO.selectIdByShopId(request.getShopId());
OpeningOperationPlanDO openingOperationPlanDO = new OpeningOperationPlanDO(); OpeningOperationPlanDO openingOperationPlanDO = new OpeningOperationPlanDO();
openingOperationPlanDO.setUpdateUserId(userId); openingOperationPlanDO.setShopId(request.getShopId());
openingOperationPlanDO.setUpdateTime(new Date()); openingOperationPlanDO.setAuditId(auditId);
openingOperationPlanDO.setResultType(request.getResultType()); openingOperationPlanDO.setResultType(request.getResultType());
Long plan = openingOperationPlanDAO.updateSelective(openingOperationPlanDO); Integer plan = openingOperationPlanDAO.updateResultType(request.getShopId(),auditId,request.getResultType());
if (Objects.isNull(plan)) { if (Objects.isNull(plan)) {
log.error("auditPlan plan is null"); log.error("auditPlan plan is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_PLAN_FALSE); throw new ServiceException(ErrorCodeEnum.UPDATE_PLAN_FALSE);

View File

@@ -7,8 +7,9 @@ import com.cool.store.dao.*;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO; import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO; import com.cool.store.dto.openPreparation.OpeningOperationPlanDTO;
import com.cool.store.dto.openPreparation.PlanLineDTO; import com.cool.store.dto.openPreparation.PlanLineDTO;
import com.cool.store.dto.openPreparation.UserInfoDTO; import com.cool.store.dto.openPreparation.UserNameDTO;
import com.cool.store.entity.OpeningOperationPlanDO; import com.cool.store.entity.OpeningOperationPlanDO;
import com.cool.store.enums.AuditStatusEnum;
import com.cool.store.enums.AuditTypeEnum; import com.cool.store.enums.AuditTypeEnum;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -78,31 +79,34 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
} }
OpeningOperationPlanAuditRequest openingOperationPlanAuditRequest = new OpeningOperationPlanAuditRequest(); OpeningOperationPlanAuditRequest openingOperationPlanAuditRequest = new OpeningOperationPlanAuditRequest();
openingOperationPlanAuditRequest.setShopId(request.getShopId()); openingOperationPlanAuditRequest.setShopId(request.getShopId());
openingOperationPlanAuditRequest.setAuditType(AuditTypeEnum.OPENING_OPERATION_PLAN.getCode());
openingOperationPlanAuditRequest.setSubmittedUserName(userName);
openingOperationPlanAuditRequest.setSubmittedUserId(userId);
Long AuditId = openingOperationPlanAuditService.addNewPlanAudit(openingOperationPlanAuditRequest); Long AuditId = openingOperationPlanAuditService.addNewPlanAudit(openingOperationPlanAuditRequest);
if (Objects.isNull(AuditId) ){ if (Objects.isNull(AuditId) ){
log.error("addNewPlan AuditId is null"); log.error("addNewPlan AuditId is null");
throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE); throw new ServiceException(ErrorCodeEnum.INSERT_OPENING_OPERATION_PLAN_AUDIT_FALSE);
} }
OpeningOperationPlanDO selectByShopId = openingOperationPlanDAO.selectByShopId(request.getShopId()); OpeningOperationPlanDO selectByShopId = openingOperationPlanDAO.selectByShopId(request.getShopId());
Long planId ; Long planId ;
if (Objects.isNull(selectByShopId)){ OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO();
OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO(); if (!Objects.isNull(selectByShopId)){
//提交修改
openingOperationPlanDO.setId(selectByShopId.getId());
openingOperationPlanDO.setSubmissionTime(new Date()); openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId); openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setAuditId(AuditId); openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setResultType(AuditStatusEnum.TODO.getCode());
planId = openingOperationPlanDAO.updateSelective(openingOperationPlanDO); planId = openingOperationPlanDAO.updateSelective(openingOperationPlanDO);
} }
else { else {
OpeningOperationPlanDO openingOperationPlanDO = request.toOpeningOperationPlanDO(); //新增
openingOperationPlanDO.setSubmissionTime(new Date()); openingOperationPlanDO.setSubmissionTime(new Date());
openingOperationPlanDO.setSubmittedUserId(userId); openingOperationPlanDO.setSubmittedUserId(userId);
openingOperationPlanDO.setCreateTime(new Date()); openingOperationPlanDO.setCreateTime(new Date());
openingOperationPlanDO.setCreateUserId(userId); openingOperationPlanDO.setCreateUserId(userId);
openingOperationPlanDO.setUpdateTime(new Date());
openingOperationPlanDO.setUpdateUserId(userId);
openingOperationPlanDO.setAuditId(AuditId); openingOperationPlanDO.setAuditId(AuditId);
openingOperationPlanDO.setResultType(AuditStatusEnum.TODO.getCode());
planId = openingOperationPlanDAO.insertSelective(openingOperationPlanDO); planId = openingOperationPlanDAO.insertSelective(openingOperationPlanDO);
} }
if (Objects.isNull(planId)){ if (Objects.isNull(planId)){
@@ -114,7 +118,6 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
log.error("auditPlan stage is null"); log.error("auditPlan stage is null");
throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE); throw new ServiceException(ErrorCodeEnum.UPDATE_SHOP_SUB_STAGE_STATUS_FALSE);
} }
return planId; return planId;
}catch (Exception e) { }catch (Exception e) {
log.error("addNewPlan Exception:{}", e); log.error("addNewPlan Exception:{}", e);
@@ -136,9 +139,9 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
if ((openingOperationPlanDO!=null)){ if ((openingOperationPlanDO!=null)){
String preparationUserIds = openingOperationPlanDO.getPreparationUserIds(); String preparationUserIds = openingOperationPlanDO.getPreparationUserIds();
List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList()); List<String> stream = Arrays.stream(preparationUserIds.split(CommonConstants.COMMA)).collect(Collectors.toList());
List<UserInfoDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream); List<UserNameDTO> nameByUserId = enterpriseUserDAO.getNameByUserId(stream);
List<String> names = nameByUserId.stream() List<String> names = nameByUserId.stream()
.map(UserInfoDTO::getName) .map(UserNameDTO::getName)
.collect(Collectors.toList()); .collect(Collectors.toList());
String preparationUserName = String.join(CommonConstants.COMMA, names); String preparationUserName = String.join(CommonConstants.COMMA, names);
BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO); BeanUtils.copyProperties(openingOperationPlanDO, openingOperationPlanVO);
@@ -156,11 +159,8 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
public List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) { public List<OpeningOperationPlanListVO> getPlanListPage(PlanListRequest request) {
log.info("getPlanListPage request:{}", JSONObject.toJSONString(request)); log.info("getPlanListPage request:{}", JSONObject.toJSONString(request));
//shopId,提交时间,审核状态 //shopId,提交时间,审核状态
OpeningOperationPlanDTO openingOperationPlanDTO =new OpeningOperationPlanDTO(); List<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO.
openingOperationPlanDTO.setPlanStartDate(request.getPlanStartDate()); selectConditionPlanList(request.getPlanStartDate(),request.getPlanEndDate(),request.getResultType());
openingOperationPlanDTO.setPlanEndDate(request.getPlanEndDate());
openingOperationPlanDTO.setResultType(request.getResultType());
List<OpeningOperationPlanDTO> openingOperationPlanDTOS = openingOperationPlanDAO.selectConditionPlanList(openingOperationPlanDTO);
log.info("getPlanListPage openingOperationPlanDTOS:{}",JSONObject.toJSONString(openingOperationPlanDTOS) ); log.info("getPlanListPage openingOperationPlanDTOS:{}",JSONObject.toJSONString(openingOperationPlanDTOS) );
//包装VO //包装VO
List<OpeningOperationPlanListVO> openingOperationPlanListVOList = openingOperationPlanDTOS.stream().map(dto->{ List<OpeningOperationPlanListVO> openingOperationPlanListVOList = openingOperationPlanDTOS.stream().map(dto->{
@@ -168,6 +168,7 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
vO.setShopId(dto.getShopId()); vO.setShopId(dto.getShopId());
vO.setSubmissionTime(dto.getSubmissionTime()); vO.setSubmissionTime(dto.getSubmissionTime());
vO.setResultType(dto.getResultType()); vO.setResultType(dto.getResultType());
vO.setAuditId(dto.getAuditId());
return vO; return vO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) ); log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) );
@@ -186,19 +187,19 @@ public class OpeningOperationPlanImpl implements OpeningOperationPlanService {
List<String> shopManagerUserIdList = openPlanShopList.stream() List<String> shopManagerUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getShopManagerUserId) .map(OpenPlanShopInfoDTO::getShopManagerUserId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<UserInfoDTO> shopManagerList = enterpriseUserDAO.getNameByUserId(shopManagerUserIdList); List<UserNameDTO> shopManagerList = enterpriseUserDAO.getNameByUserId(shopManagerUserIdList);
log.info("getPlanListPage hopManagerList :{}",JSONObject.toJSONString(shopManagerList) ); log.info("getPlanListPage hopManagerList :{}",JSONObject.toJSONString(shopManagerList) );
Map<Long,UserInfoDTO> voManagerMap = shopManagerList.stream() Map<Long, UserNameDTO> voManagerMap = shopManagerList.stream()
.collect(Collectors.toMap(UserInfoDTO::getUserId, vo -> vo)); .collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap) ); log.info("getPlanListPage voManagerMap:{}", JSONObject.toJSONString(voManagerMap) );
//督导name //督导name
List<String> supervisorUserIdList = openPlanShopList.stream() List<String> supervisorUserIdList = openPlanShopList.stream()
.map(OpenPlanShopInfoDTO::getSupervisorUserId) .map(OpenPlanShopInfoDTO::getSupervisorUserId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<UserInfoDTO> supervisorList = enterpriseUserDAO.getNameByUserId(supervisorUserIdList); List<UserNameDTO> supervisorList = enterpriseUserDAO.getNameByUserId(supervisorUserIdList);
log.info("getPlanListPage supervisorList :{}",JSONObject.toJSONString(supervisorList) ); log.info("getPlanListPage supervisorList :{}",JSONObject.toJSONString(supervisorList) );
Map<Long, UserInfoDTO> voSupervisorList = supervisorList.stream() Map<Long, UserNameDTO> voSupervisorList = supervisorList.stream()
.collect(Collectors.toMap(UserInfoDTO::getUserId, vo -> vo)); .collect(Collectors.toMap(UserNameDTO::getUserId, vo -> vo));
log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) ); log.info("getPlanListPage openingOperationPlanVOList:{}", JSONObject.toJSONString(openingOperationPlanListVOList) );
//加盟商姓名,手机号,招商name //加盟商姓名,手机号,招商name
List<Long> lines = openPlanShopList.stream() List<Long> lines = openPlanShopList.stream()

View File

@@ -123,7 +123,7 @@ public class OpenPreparationController {
FirstOrderDO firstOrderDO = new FirstOrderDO(); FirstOrderDO firstOrderDO = new FirstOrderDO();
try { try {
BeanUtils.copyProperties(firstOrderDO, request); BeanUtils.copyProperties(firstOrderDO, request);
firstOrderService.saveOrder(firstOrderDO); firstOrderService.saveOrder(request);
return ResponseResult.success(); return ResponseResult.success();
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@@ -76,9 +76,8 @@ public class MiniOpenPreparationController {
order.setResultType(firstOrderStageInfo.getShopSubStageStatus()); order.setResultType(firstOrderStageInfo.getShopSubStageStatus());
return ResponseResult.success(order); return ResponseResult.success(order);
} }
@GetMapping("/firstOrder/flush") @GetMapping("/firstOrder/flush")
public ResponseResult flush(@RequestParam Long shopId) { public ResponseResult<FirstOrderDTO> flush(@RequestParam Long shopId) {
ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15); ShopStageInfoDO orderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
try { try {
if (!orderStageInfo.getShopSubStageStatus(). if (!orderStageInfo.getShopSubStageStatus().
@@ -102,10 +101,9 @@ public class MiniOpenPreparationController {
} }
ShopStageInfoDO firstOrderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15); ShopStageInfoDO firstOrderStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_15);
log.info("flush orderStageInfo:{}", firstOrderStageInfo); log.info("flush orderStageInfo:{}", firstOrderStageInfo);
OpenPreparationFlushVO flushVO = new OpenPreparationFlushVO(); FirstOrderDTO order = firstOrderService.getOrder(shopId);
flushVO.setShopId(shopId); order.setResultType(firstOrderStageInfo.getShopSubStageStatus());
flushVO.setFirstOderState(firstOrderStageInfo.getShopSubStageStatus()); return ResponseResult.success(order);
return ResponseResult.success(flushVO);
} }