获取状态为完成的门店列表接口+记账本定时任务
This commit is contained in:
@@ -9,6 +9,7 @@ import com.cool.store.dto.point.ShopPointDTO;
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.entity.ShopInfoDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.point.ShopStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.ShopInfoMapper;
|
||||
import com.cool.store.request.BranchShopRequest;
|
||||
@@ -16,6 +17,7 @@ import com.cool.store.request.PlanListRequest;
|
||||
import com.cool.store.request.PointLinePageRequest;
|
||||
import com.cool.store.request.PreparationRequest;
|
||||
import com.cool.store.request.platformBuildListRequest;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.response.PlatformBuildListResponse;
|
||||
import com.cool.store.vo.shop.StageShopCountVO;
|
||||
import com.github.pagehelper.Page;
|
||||
@@ -27,6 +29,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
@@ -76,6 +79,13 @@ public class ShopInfoDAO {
|
||||
return shopInfoMapper.getShopList(lineId);
|
||||
}
|
||||
|
||||
public List<ShopInfoDO> getShopIdByShopStatus(Integer shopStatus){
|
||||
if (Objects.isNull(shopStatus)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return shopInfoMapper.getShopIdByShopStatus(shopStatus);
|
||||
}
|
||||
|
||||
public List<ShopInfoDO> getShopListByRegion(Long lineId,List<Long> regionIdList,String userId){
|
||||
if(Objects.isNull(lineId)){
|
||||
return new ArrayList<>();
|
||||
@@ -219,4 +229,7 @@ public class ShopInfoDAO {
|
||||
}
|
||||
return shopInfoMapper.selectByLines(lineIds,regionIds);
|
||||
}
|
||||
public List<MiniShopsResponse> getShopListAndStatusIsOverByLineId(Long lineId){
|
||||
return shopInfoMapper.getShopListAndStatusIsOverByLineId(lineId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.cool.store.request.PlanListRequest;
|
||||
import com.cool.store.request.PointLinePageRequest;
|
||||
import com.cool.store.request.PreparationRequest;
|
||||
import com.cool.store.request.platformBuildListRequest;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.response.PlatformBuildListResponse;
|
||||
import com.cool.store.vo.shop.StageShopCountVO;
|
||||
import com.github.pagehelper.Page;
|
||||
@@ -119,4 +120,8 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
|
||||
Boolean batchUpdate(List<ShopInfoDO> list);
|
||||
|
||||
List<ShopInfoDO> selectByLines (@Param("list") List<Long> list,@Param("regionIds") List<Long> regionIds);
|
||||
|
||||
List<ShopInfoDO> getShopIdByShopStatus(@Param("shopStatus") Integer shopStatus);
|
||||
|
||||
List<MiniShopsResponse> getShopListAndStatusIsOverByLineId(Long lineId);
|
||||
}
|
||||
|
||||
@@ -403,6 +403,16 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getShopIdByShopStatus" resultType="com.cool.store.entity.ShopInfoDO">
|
||||
select id ,partner_id as partnerId
|
||||
from xfsg_shop_info
|
||||
where shop_status = #{shopStatus}
|
||||
</select>
|
||||
<select id="getShopListAndStatusIsOverByLineId" resultType="com.cool.store.response.MiniShopsResponse">
|
||||
select id, shop_name as shopName
|
||||
from xfsg_shop_info
|
||||
where line_id = #{lineId} and shop_status = 1
|
||||
</select>
|
||||
|
||||
<update id="batchUpdate" parameterType="list">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
|
||||
@@ -86,9 +86,11 @@ public class MiniAddPointRequest {
|
||||
@ApiModelProperty("街道")
|
||||
private String township;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty("机会点编号")
|
||||
private String opportunityPointCode;
|
||||
|
||||
@NotBlank
|
||||
@ApiModelProperty("机会点名称")
|
||||
private String opportunityPointName;
|
||||
|
||||
|
||||
@@ -81,8 +81,6 @@ public class TallyBookRequest {
|
||||
tallyBookDO.setStaffDormitoryFee(staffDormitoryFee);
|
||||
tallyBookDO.setConsumablesCost(consumablesCost);
|
||||
tallyBookDO.setTotalCost(totalCost);
|
||||
tallyBookDO.setCreateTime(new Date());
|
||||
tallyBookDO.setUpdateTime(new Date());
|
||||
return tallyBookDO;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.cool.store.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: WangShuo
|
||||
* @Date: 2025/03/31/16:46
|
||||
* @Version 1.0
|
||||
* @注释:
|
||||
*/
|
||||
@Data
|
||||
public class MiniShopsResponse {
|
||||
private Long shopId;
|
||||
private String shopName;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.cool.store.entity.ShopInfoDO;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.response.BranchShopDetailResponse;
|
||||
import com.cool.store.response.BranchShopResponse;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.vo.shop.MiniShopPageVO;
|
||||
import com.cool.store.vo.shop.ShopStageInfoVO;
|
||||
import com.cool.store.vo.shop.StageShopCountVO;
|
||||
@@ -103,4 +104,6 @@ public interface ShopService {
|
||||
PageInfo<BranchShopResponse> getBranchShopList(BranchShopRequest request, String userId);
|
||||
|
||||
Boolean dataHandler(Long shopId);
|
||||
|
||||
List<MiniShopsResponse> getShopListAndStatusIsOverByLineId(Long lineId);
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ public interface TallyBookService {
|
||||
|
||||
List<TallyBookDTO> getTallyBookListByShopIdAndYear(Long shopId, Integer year);
|
||||
|
||||
Long initData(Date date, Long shopId, String partnerId);
|
||||
Long initData( Long shopId, String partnerId);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.cool.store.mapper.RegionMapper;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.response.BranchShopDetailResponse;
|
||||
import com.cool.store.response.BranchShopResponse;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.NumberConverter;
|
||||
import com.cool.store.utils.RandomEightCharCodeUtils;
|
||||
@@ -522,5 +523,10 @@ public class ShopServiceImpl implements ShopService {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MiniShopsResponse> getShopListAndStatusIsOverByLineId(Long lineId) {
|
||||
return shopInfoDAO.getShopListAndStatusIsOverByLineId(lineId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dao.TallyBookDAO;
|
||||
import com.cool.store.dto.TallyBookDTO;
|
||||
import com.cool.store.entity.TallyBookDO;
|
||||
@@ -8,6 +9,7 @@ import com.cool.store.enums.TallyBookStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.TallyBookRequest;
|
||||
import com.cool.store.service.TallyBookService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -24,6 +26,7 @@ import java.util.stream.Collectors;
|
||||
* @Version 1.0
|
||||
* @注释:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TallyBookServiceImpl implements TallyBookService {
|
||||
|
||||
@@ -36,10 +39,12 @@ public class TallyBookServiceImpl implements TallyBookService {
|
||||
tallyBookDO.setStatus(TallyBookStatusEnum.IS_SUBMIT.getCode());
|
||||
if (request.getId()==null){
|
||||
tallyBookDO.setCreateUser(partnerId);
|
||||
tallyBookDO.setCreateTime(new Date());
|
||||
tallyBookDO.setPartnerId(partnerId);
|
||||
return tallyBookDAO.insertSelective(tallyBookDO);
|
||||
return tallyBookDAO.insertSelective(tallyBookDO);
|
||||
}else{
|
||||
tallyBookDO.setUpdateUser(partnerId);
|
||||
tallyBookDO.setUpdateTime(new Date());
|
||||
return tallyBookDAO.updateByPrimaryKeySelective(tallyBookDO);
|
||||
}
|
||||
}
|
||||
@@ -60,7 +65,8 @@ public class TallyBookServiceImpl implements TallyBookService {
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public Long initData(Date date,Long shopId, String partnerId){
|
||||
public Long initData(Long shopId, String partnerId){
|
||||
Date date = new Date();
|
||||
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
// 获取年份
|
||||
int year = localDate.getYear();
|
||||
@@ -74,6 +80,7 @@ public class TallyBookServiceImpl implements TallyBookService {
|
||||
tallyBookDO.setMonth(month);
|
||||
tallyBookDO.setCreateTime(new Date());
|
||||
tallyBookDO.setStatus(TallyBookStatusEnum.NOT_SUBMIT.getCode());
|
||||
log.info("initData记账本DO:{}", JSONObject.toJSONString(tallyBookDO));
|
||||
if(CollectionUtils.isEmpty(list)){
|
||||
return tallyBookDAO.insertSelective(tallyBookDO);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.controller.webc;
|
||||
|
||||
import com.cool.store.context.PartnerUserHolder;
|
||||
import com.cool.store.request.*;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.PointService;
|
||||
import com.cool.store.service.ShopService;
|
||||
@@ -115,6 +116,10 @@ public class MiniShopController {
|
||||
request.setCurLineId(lineId);
|
||||
return ResponseResult.success(pointService.updateRentContract(request));
|
||||
}
|
||||
|
||||
@ApiOperation("获取状态为完成的门店列表")
|
||||
@GetMapping("/getStatusOver")
|
||||
public ResponseResult<List<MiniShopsResponse>> getShopListAndStatusIsOverByLineId(@RequestParam("lineId")Long lineId) {
|
||||
return ResponseResult.success(shopService.getShopListAndStatusIsOverByLineId(lineId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.TallyBookService;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -27,12 +29,14 @@ public class TallyBookController {
|
||||
private TallyBookService tallyBookService;
|
||||
|
||||
@PostMapping("/insertOrUpdate")
|
||||
@ApiOperation(value = "新增或修改记账本")
|
||||
public ResponseResult insertOrUpdateSelective(@RequestBody @Validated TallyBookRequest request) {
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
return ResponseResult.success(tallyBookService.insertOrUpdateSelective(request, user.getPartnerId()));
|
||||
}
|
||||
|
||||
@GetMapping("/getTallyBookListByShopIdAndYear")
|
||||
@ApiOperation(value = "根据店铺id和年份查询记账本")
|
||||
public ResponseResult<List<TallyBookDTO>> getTallyBookListByShopIdAndYear(@RequestParam("shopId") Long shopId, @RequestParam("year") Integer year) {
|
||||
PartnerUserInfoVO user = PartnerUserHolder.getUser();
|
||||
return ResponseResult.success(tallyBookService.getTallyBookListByShopIdAndYear(shopId,year));
|
||||
|
||||
@@ -271,4 +271,8 @@ public class TestController {
|
||||
return ResponseResult.success(shopService.dataHandler(lineId));
|
||||
}
|
||||
|
||||
@GetMapping("/initTallyBook")
|
||||
public void initTallyBook(){
|
||||
xxlJobHandler.initTallyBook();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.cool.store.dto.decoration.ConstructionScheduleDTO;
|
||||
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.enums.point.ShopStatusEnum;
|
||||
import com.cool.store.enums.point.ShopSubStageEnum;
|
||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
@@ -98,7 +99,8 @@ public class XxlJobHandler {
|
||||
private SimpleMessageService simpleMessageService;
|
||||
@Resource
|
||||
ApplyLicenseMapper applyLicenseMapper;
|
||||
|
||||
@Resource
|
||||
private TallyBookService tallyBookService;
|
||||
|
||||
|
||||
|
||||
@@ -314,7 +316,23 @@ public class XxlJobHandler {
|
||||
int pageSize = 10;
|
||||
List<Long> shopIdList = new ArrayList<>();
|
||||
while (hasNext) {
|
||||
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<ShopInfoDO> shopList = shopInfoDAO.getShopIdByShopStatus(ShopStatusEnum.DONE.getCode());
|
||||
if (CollectionUtils.isEmpty(shopList)) {
|
||||
log.info("------initTallyBook is empty------");
|
||||
break;
|
||||
}
|
||||
for (ShopInfoDO shopInfoDO : shopList){
|
||||
try {
|
||||
tallyBookService.initData( shopInfoDO.getId(), shopInfoDO.getPartnerId());
|
||||
}catch (Exception e){
|
||||
log.info("生成记账本数据出错:shopId:{},Exception:{}",shopInfoDO.getId(),e.getMessage());
|
||||
}
|
||||
}
|
||||
if (shopList.size() < pageSize){
|
||||
hasNext = false;
|
||||
}
|
||||
pageNum++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user