统计报表接口,数据梳理接口
This commit is contained in:
@@ -11,6 +11,7 @@ import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Auther: WangShuo
|
||||
@@ -57,4 +58,14 @@ public class AcceptanceInfoDAO {
|
||||
public List<AcceptanceInfoDO> selectByEntryTimeNull(){
|
||||
return acceptanceInfoMapper.selectByEntryTimeNull();
|
||||
}
|
||||
|
||||
public List<Long> getAllShopIds(){
|
||||
List<AcceptanceInfoDO> acceptanceInfoDOList = acceptanceInfoMapper.selectAll();
|
||||
|
||||
return acceptanceInfoDOList.stream().map(AcceptanceInfoDO::getShopId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Integer initAcceptanceInfo(List<Long> shopIds){
|
||||
return acceptanceInfoMapper.initAcceptanceInfo(shopIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,7 @@ public interface AcceptanceInfoMapper extends Mapper<AcceptanceInfoDO> {
|
||||
* @description:查询进场时间为空的数据
|
||||
*/
|
||||
List<AcceptanceInfoDO> selectByEntryTimeNull();
|
||||
|
||||
|
||||
Integer initAcceptanceInfo(@Param("list") List<Long> shopIds);
|
||||
}
|
||||
@@ -98,6 +98,9 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
|
||||
*/
|
||||
List<ShopInfoDO> selectShopListByRegionId(@Param("regionIds") List<Long> regionIds,@Param("shopSubStage") Integer shopSubStage,@Param("subStageStatus")List<Integer> subStageStatus,@Param("keyWord")String keyWord);
|
||||
|
||||
List<ShopInfoDO> selectShopListByUser(@Param("userId") String userId,@Param("shopSubStage") Integer shopSubStage,@Param("subStageStatus")List<Integer> subStageStatus,@Param("keyWord")String keyWord);
|
||||
|
||||
|
||||
|
||||
List<ShopInfoDO> selectByIdOrSelectAll(@Param("shopId") Long shopId);
|
||||
|
||||
|
||||
@@ -36,6 +36,12 @@
|
||||
create_time,update_time,deleted,plan_acceptance_time,actual_acceptance_time,booking_user,plan_exit_time,
|
||||
ks_account,verification_mobile,shop_location_screenshots,shop_doorway_photo,shop_interior_photo
|
||||
</sql>
|
||||
<insert id="initAcceptanceInfo">
|
||||
<foreach collection="list" index="index" item="item" separator=";">
|
||||
insert into xfsg_acceptance_info (shop_id,create_time,update_time,deleted)
|
||||
values (#{item},now(),now(),0)
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateByShopIDSelective">
|
||||
update xfsg_acceptance_info
|
||||
<set>
|
||||
|
||||
@@ -506,6 +506,30 @@
|
||||
</if>
|
||||
and b.actual_complete_time >= #{request.buildStartTime} and b.actual_complete_time <= #{request.buildEndTime}
|
||||
</select>
|
||||
<select id="selectShopListByUser" resultType="com.cool.store.entity.ShopInfoDO">
|
||||
select
|
||||
xsi.id,xsi.line_id as lineId,xsi.region_id as regionId,xsi.shop_name as shopName,xsi.store_num as
|
||||
storeNum,xsi.shop_code as shopCode
|
||||
from xfsg_shop_info xsi
|
||||
left join xfsg_shop_stage_info xssi on xssi.shop_id = xsi.id
|
||||
where
|
||||
xsi.deleted = 0
|
||||
AND xssi.shop_sub_stage_status != -100
|
||||
and xssi.shop_sub_stage = #{shopSubStage}
|
||||
<if test="userId!=null and userId!= ''">
|
||||
and xsi.investment_manager = #{userId}
|
||||
</if>
|
||||
|
||||
<if test="subStageStatus != null and subStageStatus.size()>0">
|
||||
and xssi.shop_sub_stage_status in
|
||||
<foreach collection="subStageStatus" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != '' ">
|
||||
and xsi.shop_name Like concat("%",#{keyWord},"%") or xsi.store_num Like concat("%",#{keyWord},"%")
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="batchUpdate" parameterType="list">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
|
||||
@@ -24,4 +24,7 @@ public interface DataHandlerServer {
|
||||
|
||||
//数据处理阶段完成 某些阶段数据处理
|
||||
Boolean dataStageHandler(List<Map<String, Object>> dataMapList, String originalFilename, LoginUserInfo user, ImportTaskDO task,Boolean flag);
|
||||
|
||||
//装修数据初始化
|
||||
Boolean decorationDataInit();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ import static com.cool.store.utils.poi.DateUtils.YYYY_MM_DD;
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DataHandlerServerImpl implements DataHandlerServer {
|
||||
@Resource
|
||||
private AcceptanceInfoDAO acceptanceInfoDAO;
|
||||
@Resource
|
||||
private ImportTaskMapper importTaskMapper;
|
||||
@Resource
|
||||
@@ -535,6 +537,26 @@ public class DataHandlerServerImpl implements DataHandlerServer {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean decorationDataInit() {
|
||||
|
||||
//施工阶段
|
||||
List<ShopStageInfoDO> subStages = shopStageInfoDAO.getSubStages(ShopSubStageEnum.SHOP_STAGE_11.getShopSubStage());
|
||||
List<Long> allShopIds = acceptanceInfoDAO.getAllShopIds();
|
||||
//需要处理的门店
|
||||
List<Long> addShopIds = new ArrayList<>();
|
||||
for (ShopStageInfoDO subStage : subStages){
|
||||
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112.getShopSubStageStatus().equals(subStage.getShopSubStageStatus())){
|
||||
if (!allShopIds.contains(subStage.getShopId())){
|
||||
addShopIds.add(subStage.getShopId());
|
||||
}
|
||||
}
|
||||
}
|
||||
acceptanceInfoDAO.initAcceptanceInfo(addShopIds);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean check(ImportOaOldShopDataDTO dto, List<ImportOaOldShopDataErrorDTO> errorList) {
|
||||
if (StringUtil.isBlank(dto.getShopCode())) {
|
||||
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO();
|
||||
|
||||
@@ -377,22 +377,24 @@ public class DecorationServiceImpl implements DecorationService {
|
||||
|
||||
@Override
|
||||
public PageInfo<fitmentCheckVO> getFitmentAcceptanceList(AcceptanceListRequest request, LoginUserInfo user) {
|
||||
List<Long> regions = new ArrayList<>();
|
||||
if (!sysRoleService.checkIsAdmin(user.getUserId())) {
|
||||
List<String> authRegionIds = userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(user.getUserId());
|
||||
for (String authRegionId : authRegionIds) {
|
||||
regions.add(Long.parseLong(authRegionId));
|
||||
}
|
||||
if (regions.isEmpty()) {
|
||||
log.info("该用户下权限没有管理区域");
|
||||
return new PageInfo<>();
|
||||
}
|
||||
}
|
||||
// List<Long> regions = new ArrayList<>();
|
||||
// if (!sysRoleService.checkIsAdmin(user.getUserId())) {
|
||||
// List<String> authRegionIds = userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(user.getUserId());
|
||||
// for (String authRegionId : authRegionIds) {
|
||||
// regions.add(Long.parseLong(authRegionId));
|
||||
// }
|
||||
// if (regions.isEmpty()) {
|
||||
// log.info("该用户下权限没有管理区域");
|
||||
// return new PageInfo<>();
|
||||
// }
|
||||
// }
|
||||
//判断是否是管理员
|
||||
Boolean isAdmin = sysRoleService.checkIsAdmin(user.getUserId());
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<fitmentCheckVO> fitmentCheckVOList = new ArrayList<>();
|
||||
//shopId,lineid,regionid,shopname,storenum,
|
||||
|
||||
List<ShopInfoDO> shopInfoDOS = shopInfoMapper.selectShopListByRegionId(regions, ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), request.getSubStageStatus(), null);
|
||||
//督导查询是自己的
|
||||
List<ShopInfoDO> shopInfoDOS = shopInfoMapper.selectShopListByUser(isAdmin?null:user.getUserId(), ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage(), request.getSubStageStatus(), null);
|
||||
PageInfo pageInfo = new PageInfo<>(shopInfoDOS);
|
||||
if (shopInfoDOS.isEmpty()) {
|
||||
log.info("该工程部监理下门店为空");
|
||||
|
||||
@@ -13,10 +13,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -44,6 +41,7 @@ public class DataHandlerController {
|
||||
|
||||
@Value("${mybatis.configuration.variables.enterpriseId}")
|
||||
private String eid;
|
||||
|
||||
@PostMapping("/importOaOldShopData")
|
||||
@ApiOperation("导入OA旧数据")
|
||||
public ResponseResult<Boolean> importOaOldShopData(MultipartFile file) {
|
||||
@@ -54,7 +52,7 @@ public class DataHandlerController {
|
||||
log.error("read file error:", e);
|
||||
}
|
||||
assert reader != null;
|
||||
log.info("----------------------:{}",file.getOriginalFilename());
|
||||
log.info("----------------------:{}", file.getOriginalFilename());
|
||||
List<Map<String, Object>> dataMapList = reader.read(0, 1, Integer.MAX_VALUE);
|
||||
ImportTaskDO importTaskDO = new ImportTaskDO();
|
||||
importTaskDO.setFileName(file.getOriginalFilename());
|
||||
@@ -64,7 +62,7 @@ public class DataHandlerController {
|
||||
importTaskDO.setCreateUserId(CurrentUserHolder.getUserId());
|
||||
importTaskDO.setCreateName(CurrentUserHolder.getUser().getName());
|
||||
importTaskDO.setCreateTime(System.currentTimeMillis());
|
||||
importTaskMapper.insert(eid ,importTaskDO);
|
||||
importTaskMapper.insert(eid, importTaskDO);
|
||||
dataHandlerServer.importOaOldShopData(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO);
|
||||
return ResponseResult.success(true);
|
||||
}
|
||||
@@ -79,7 +77,7 @@ public class DataHandlerController {
|
||||
log.error("read file error:", e);
|
||||
}
|
||||
assert reader != null;
|
||||
log.info("----------------------:{}",file.getOriginalFilename());
|
||||
log.info("----------------------:{}", file.getOriginalFilename());
|
||||
List<Map<String, Object>> dataMapList = reader.read(0, 1, Integer.MAX_VALUE);
|
||||
ImportTaskDO importTaskDO = new ImportTaskDO();
|
||||
importTaskDO.setFileName(file.getOriginalFilename());
|
||||
@@ -89,10 +87,16 @@ public class DataHandlerController {
|
||||
importTaskDO.setCreateUserId(CurrentUserHolder.getUserId());
|
||||
importTaskDO.setCreateName(CurrentUserHolder.getUser().getName());
|
||||
importTaskDO.setCreateTime(System.currentTimeMillis());
|
||||
importTaskMapper.insert(eid ,importTaskDO);
|
||||
dataHandlerServer.dataStageHandler(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO,flag);
|
||||
importTaskMapper.insert(eid, importTaskDO);
|
||||
dataHandlerServer.dataStageHandler(dataMapList, file.getOriginalFilename(), CurrentUserHolder.getUser(), importTaskDO, flag);
|
||||
return ResponseResult.success(true);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("decorationDataInit")
|
||||
@ApiOperation("装修数据初始化")
|
||||
public ResponseResult decorationDataInit() {
|
||||
dataHandlerServer.decorationDataInit();
|
||||
return ResponseResult.success(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user