开店管理导出加字段
This commit is contained in:
@@ -1,10 +1,16 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
import com.cool.store.entity.FranchiseFeeDO;
|
import com.cool.store.entity.FranchiseFeeDO;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
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.Map;
|
||||||
|
|
||||||
public interface FranchiseFeeMapper extends Mapper<FranchiseFeeDO> {
|
public interface FranchiseFeeMapper extends Mapper<FranchiseFeeDO> {
|
||||||
FranchiseFeeDO selectByShopId(@Param("shopId") Long shopId);
|
FranchiseFeeDO selectByShopId(@Param("shopId") Long shopId);
|
||||||
|
@MapKey("shopId")
|
||||||
|
Map<Long, Date> getPayTimeByShopIds(@Param("shopIds") List<Long> shopIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,14 @@
|
|||||||
order by create_time desc
|
order by create_time desc
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getPayTimeByShopIds" resultType="java.util.HashMap">
|
||||||
|
select a.shop_id AS shopId ,
|
||||||
|
b.pay_time as payTime
|
||||||
|
from xfsg_franchise_fee a
|
||||||
|
LEFT JOIN xfsg_line_pay b ON b.id = a.pay_id;
|
||||||
|
where a.shop_id in
|
||||||
|
<foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
|
||||||
|
#{shopId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -110,5 +110,8 @@ public class ExportBranchShopDTO {
|
|||||||
@ColumnWidth(30)
|
@ColumnWidth(30)
|
||||||
private String openDuration;
|
private String openDuration;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "缴费时间",order = 24)
|
||||||
|
@ColumnWidth(30)
|
||||||
|
private String payTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ExportRealizeService {
|
public interface ExportRealizeService {
|
||||||
|
|
||||||
void preparationList( List<PreparationDTO> preparationDTOS,ImportTaskDO importTaskDO);
|
|
||||||
void branchShopList(List<BranchShopResponse> list,ImportTaskDO importTaskDO);
|
void branchShopList(List<BranchShopResponse> list,ImportTaskDO importTaskDO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import com.cool.store.request.*;
|
|||||||
* @注释:
|
* @注释:
|
||||||
*/
|
*/
|
||||||
public interface ExportService {
|
public interface ExportService {
|
||||||
Integer preparationList(PreparationRequest request,LoginUserInfo loginUserInfo);
|
|
||||||
|
|
||||||
Long branchShopList(BranchShopRequest request,LoginUserInfo user);
|
Long branchShopList(BranchShopRequest request,LoginUserInfo user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ import com.cool.store.entity.*;
|
|||||||
import com.cool.store.enums.*;
|
import com.cool.store.enums.*;
|
||||||
import com.cool.store.enums.point.*;
|
import com.cool.store.enums.point.*;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.mapper.ImportTaskMapper;
|
import com.cool.store.mapper.*;
|
||||||
import com.cool.store.mapper.IntentAgreementMapper;
|
|
||||||
import com.cool.store.mapper.PointInfoMapper;
|
|
||||||
import com.cool.store.mapper.SignFranchiseMapper;
|
|
||||||
import com.cool.store.request.InitiatingRequest;
|
import com.cool.store.request.InitiatingRequest;
|
||||||
import com.cool.store.response.BranchShopResponse;
|
import com.cool.store.response.BranchShopResponse;
|
||||||
import com.cool.store.service.*;
|
import com.cool.store.service.*;
|
||||||
@@ -54,7 +51,7 @@ import static com.cool.store.utils.poi.DateUtils.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ExportRealizeServiceImpl implements ExportRealizeService {
|
public class ExportRealizeServiceImpl implements ExportRealizeService {
|
||||||
@Resource
|
@Resource
|
||||||
private InvoicingDAO invoicingDAO;
|
private FranchiseFeeMapper franchiseFeeMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ImportTaskMapper importTaskMapper;
|
private ImportTaskMapper importTaskMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -93,71 +90,8 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RegionDao regionDao;
|
private RegionDao regionDao;
|
||||||
|
|
||||||
@Async
|
@Resource
|
||||||
@Override
|
private InvoicingDAO invoicingDAO;
|
||||||
public void preparationList(List<PreparationDTO> preparationDTOS, ImportTaskDO importTaskDO) {
|
|
||||||
Boolean flag = Boolean.TRUE;
|
|
||||||
String url = "";
|
|
||||||
try {
|
|
||||||
List<Long> shopIds = preparationDTOS.stream().map(PreparationDTO::getId).collect(Collectors.toList());
|
|
||||||
List<ScheduleDTO> scheduleList = shopStageInfoDAO.getScheduleList(shopIds);
|
|
||||||
List<ShopStageInfoDO> shopContractActualCompletionTime = shopStageInfoDAO.getShopContractActualCompletionTime(shopIds);
|
|
||||||
Map<Long, ScheduleDTO> scheduleDTOMap = scheduleList.stream().collect(Collectors.toMap(ScheduleDTO::getShopId, x -> x));
|
|
||||||
Map<Long, ShopStageInfoDO> shopStageInfoDOMap = shopContractActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
|
|
||||||
List<Long> regionIds = preparationDTOS.stream().map(PreparationDTO::getRegionId).collect(Collectors.toList());
|
|
||||||
Map<Long, String> regionNameMap = regionService.getBelongWarRegionNameMap(regionIds);
|
|
||||||
Set<String> userIds = preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getShopManagerUserId())).map(PreparationDTO::getShopManagerUserId).collect(Collectors.toSet());
|
|
||||||
userIds.addAll(preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getInvestmentManager())).map(PreparationDTO::getInvestmentManager).collect(Collectors.toSet()));
|
|
||||||
userIds.addAll(preparationDTOS.stream().filter(x -> StringUtils.isNotEmpty(x.getSupervisorUserId())).map(PreparationDTO::getSupervisorUserId).collect(Collectors.toSet()));
|
|
||||||
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(new ArrayList<>(userIds));
|
|
||||||
List<ShopStageInfoDO> openActivityActualCompletionTime = shopStageInfoDAO.getOpenActivityActualCompletionTime(shopIds);
|
|
||||||
Map<Long, ShopStageInfoDO> openActivityStageMap;
|
|
||||||
if (openActivityActualCompletionTime != null) {
|
|
||||||
openActivityStageMap = openActivityActualCompletionTime.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, x -> x));
|
|
||||||
} else {
|
|
||||||
openActivityStageMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
List<PreparationScheduleDTO> result = new ArrayList<>();
|
|
||||||
preparationDTOS.forEach(x -> {
|
|
||||||
PreparationScheduleDTO dto1 = new PreparationScheduleDTO();
|
|
||||||
dto1.setMobile(x.getMobile());
|
|
||||||
dto1.setUsername(x.getUsername());
|
|
||||||
dto1.setShopName(x.getShopName());
|
|
||||||
dto1.setPlanOpenTime(DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, x.getPlanOpenTime()));
|
|
||||||
dto1.setShopCode(x.getShopCode());
|
|
||||||
dto1.setSupervisionName(userInfoMap.getOrDefault(x.getSupervisorUserId(), new EnterpriseUserDO()).getName());
|
|
||||||
dto1.setInvestmentManagerName(userInfoMap.getOrDefault(x.getInvestmentManager(), new EnterpriseUserDO()).getName());
|
|
||||||
dto1.setRegionNodeName(regionNameMap.getOrDefault(x.getRegionId(), ""));
|
|
||||||
ScheduleDTO dto = scheduleDTOMap.getOrDefault(x.getId(), new ScheduleDTO());
|
|
||||||
dto1.setCurrentProgress(dto.getCompletionColumn().toString() + "/" + dto.getTotalColumn().toString());
|
|
||||||
if (openActivityStageMap.containsKey(x.getId())) {
|
|
||||||
Date openActivity = DateUtils.strToDate(openActivityStageMap.get(x.getId()).getActualCompleteTime(), YYYY_MM_DD_HH_MM_SS);
|
|
||||||
long between = ChronoUnit.SECONDS.between(x.getCreateTime().toInstant(), openActivity.toInstant());
|
|
||||||
double days = (double) between / (24 * 60 * 60);
|
|
||||||
dto1.setDays(String.format("%.1f", days));
|
|
||||||
} else {
|
|
||||||
long between = ChronoUnit.SECONDS.between(x.getCreateTime().toInstant(), new Date().toInstant());
|
|
||||||
double days = (double) between / (24 * 60 * 60);
|
|
||||||
dto1.setDays(String.format("%.1f", days));
|
|
||||||
}
|
|
||||||
result.add(dto1);
|
|
||||||
});
|
|
||||||
url = easyExcelUtil.exportExcel(PreparationScheduleDTO.class, result, null, FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()), FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(SPECIAL_DATE_START_1, new Date()));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
flag = Boolean.FALSE;
|
|
||||||
log.error("fileUpload upload err, originFileName={}", FileTypeEnum.PREPARATION.getDesc(), e);
|
|
||||||
throw new ServiceException(ErrorCodeEnum.INTERNAL_SERVER_ERROR);
|
|
||||||
} finally {
|
|
||||||
if (flag) {
|
|
||||||
importTaskDO.setStatus(ImportStatusEnum.success.getCode());
|
|
||||||
importTaskDO.setFileUrl(url);
|
|
||||||
} else {
|
|
||||||
importTaskDO.setStatus(ImportStatusEnum.fail.getCode());
|
|
||||||
}
|
|
||||||
importTaskMapper.update(eid, importTaskDO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public void branchShopList(List<BranchShopResponse> list, ImportTaskDO importTaskDO) {
|
public void branchShopList(List<BranchShopResponse> list, ImportTaskDO importTaskDO) {
|
||||||
@@ -167,6 +101,7 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
|||||||
List<ExportBranchShopDTO> exportList = new ArrayList<>();
|
List<ExportBranchShopDTO> exportList = new ArrayList<>();
|
||||||
List<Long> shopIds = list.stream().map(BranchShopResponse::getShopId).collect(Collectors.toList());
|
List<Long> shopIds = list.stream().map(BranchShopResponse::getShopId).collect(Collectors.toList());
|
||||||
List<SignFranchiseDO> signFranchises = signFranchiseMapper.selectByShopIds(shopIds);
|
List<SignFranchiseDO> signFranchises = signFranchiseMapper.selectByShopIds(shopIds);
|
||||||
|
Map<Long, Date> payTimeByShopIds = franchiseFeeMapper.getPayTimeByShopIds(shopIds);
|
||||||
Map<Long, SignFranchiseDO> signFranchiseMap = new HashMap<>();
|
Map<Long, SignFranchiseDO> signFranchiseMap = new HashMap<>();
|
||||||
if (signFranchises != null) {
|
if (signFranchises != null) {
|
||||||
signFranchiseMap = signFranchises.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity()));
|
signFranchiseMap = signFranchises.stream().collect(Collectors.toMap(SignFranchiseDO::getShopId, Function.identity()));
|
||||||
@@ -192,6 +127,7 @@ public class ExportRealizeServiceImpl implements ExportRealizeService {
|
|||||||
dto.setContractStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractStartTime()));
|
dto.setContractStartTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractStartTime()));
|
||||||
dto.setContractEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractEndTime()));
|
dto.setContractEndTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, signFranchiseDO.getContractEndTime()));
|
||||||
}
|
}
|
||||||
|
dto.setPayTime(DateUtils.parseDateToStr(SPECIAL_DATE_START_1, payTimeByShopIds.get(response.getShopId())));
|
||||||
InvoicingDO invoicingDO = InvoicingMap.get(response.getShopId());
|
InvoicingDO invoicingDO = InvoicingMap.get(response.getShopId());
|
||||||
if (invoicingDO != null) {
|
if (invoicingDO != null) {
|
||||||
dto.setInvoicingTime(invoicingDO.getInvoiceDate());
|
dto.setInvoicingTime(invoicingDO.getInvoiceDate());
|
||||||
|
|||||||
@@ -73,42 +73,7 @@ public class ExportServiceImpl implements ExportService {
|
|||||||
private ShopService shopService;
|
private ShopService shopService;
|
||||||
|
|
||||||
|
|
||||||
//原先进度管理接口废弃,使用branchShopList
|
|
||||||
@Override
|
|
||||||
public Integer preparationList(PreparationRequest request, LoginUserInfo loginUserInfo) {
|
|
||||||
if (!sysRoleService.checkIsAdmin(request.getCurUserId())) {
|
|
||||||
request.setAuthRegionIds(userAuthMappingService.getAuthRegionIdAndSubRegionIdByUserId(request.getCurUserId()));
|
|
||||||
}
|
|
||||||
if (CollectionUtils.isNotEmpty(request.getRegionIds())) {
|
|
||||||
if (request.getRegionIds().contains(CommonConstants.ROOT_DEPT_ID_STR)) {
|
|
||||||
request.setRegionIds(null);
|
|
||||||
} else {
|
|
||||||
request.setRegionIds(regionService.getSubRegionIdsByRegionIds(request.getRegionIds()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//进度数据
|
|
||||||
List<PreparationDTO> preparationDTOS = shopInfoDAO.ListByCondition(request);
|
|
||||||
if (CollectionUtils.isEmpty(preparationDTOS)) {
|
|
||||||
throw new ServiceException(ErrorCodeEnum.NO_DATA);
|
|
||||||
}
|
|
||||||
List<PreparationDTO> result;
|
|
||||||
if (preparationDTOS.size() > CommonConstants.MAX_EXPORT_SIZE) {
|
|
||||||
result = preparationDTOS.subList(0, CommonConstants.MAX_EXPORT_SIZE);
|
|
||||||
} else {
|
|
||||||
result = preparationDTOS;
|
|
||||||
}
|
|
||||||
ImportTaskDO importTaskDO = new ImportTaskDO();
|
|
||||||
importTaskDO.setStatus(ImportStatusEnum.Ongoing.getCode());
|
|
||||||
importTaskDO.setFileName(FileTypeEnum.PREPARATION.getDesc() + DateUtils.parseDateToStr(DateUtils.SPECIAL_DATE_START_1, new Date()));
|
|
||||||
importTaskDO.setIsImport(Boolean.FALSE);
|
|
||||||
importTaskDO.setFileType(FileTypeEnum.PREPARATION.getFileType());
|
|
||||||
importTaskDO.setCreateUserId(request.getCurUserId());
|
|
||||||
importTaskDO.setCreateTime(new Date().getTime());
|
|
||||||
importTaskDO.setCreateName(loginUserInfo.getName());
|
|
||||||
importTaskMapper.insert(eid, importTaskDO);
|
|
||||||
exportRealizeService.preparationList(result, importTaskDO);
|
|
||||||
return result.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long branchShopList(BranchShopRequest request, LoginUserInfo user) {
|
public Long branchShopList(BranchShopRequest request, LoginUserInfo user) {
|
||||||
|
|||||||
Reference in New Issue
Block a user