提交 360c6350 authored 作者: 李秋林's avatar 李秋林

1、创建稽查任务;2、按ID判断修改/新增;3、按id/分页查询;4、引入db表

上级 9a5c50c5
package com.wangxiaolu.promotion.controller.activity.examine;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.pojo.activity.examine.vo.ExaPlanVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activity.examine.ExaPlanCoreService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2025-04-02 13
* @describe :
*/
@RestController
@RequestMapping("/exa/core")
public class ExaPlanCoreController {
@Autowired
private ExaPlanCoreService exaPlanCoreService;
@PostMapping("/save")
public R saveOne(@RequestBody ExaPlanVo exaPlanVo) {
ActivityExamineDto examineDto = new ActivityExamineDto();
BeanUtils.copyProperties(exaPlanVo, examineDto);
if (Objects.isNull(exaPlanVo.getId())) {
examineDto.setCreateBy(exaPlanVo.getOperName());
saveOne(examineDto);
} else {
examineDto.setModifyBy(exaPlanVo.getOperName());
updateById(examineDto);
}
return R.success();
}
private void saveOne(ActivityExamineDto examineDto) {
exaPlanCoreService.save(examineDto);
}
private void updateById(ActivityExamineDto examineDto) {
exaPlanCoreService.updateById(examineDto);
}
}
package com.wangxiaolu.promotion.controller.activity.examine;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activity.examine.ExaPlanQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
/**
* @author : liqiulin
* @date : 2025-04-02 13
* @describe :
*/
@RestController
@RequestMapping("/exa/query")
public class ExaPlanQueryController {
@Autowired
private ExaPlanQueryService exaPlanQueryService;
@GetMapping("/{id}")
public R selectById(@PathVariable @PathParam("id") Long id) {
ActivityExamineDto examineDto = exaPlanQueryService.selectById(id);
return R.success(examineDto);
}
@PostMapping("/page")
public R page(@RequestBody PageInfo pageInfo){
exaPlanQueryService.page(pageInfo);
return R.success(pageInfo);
}
}
...@@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollectionUtil;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryActivityWrapper; import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryActivityWrapper;
import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper; import com.wangxiaolu.promotion.domain.activity.wrapperQo.TemporaryClockWrapper;
import com.wangxiaolu.promotion.pojo.PageInfo; import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.pojo.activity.planv2.response.ActivityResponse; import com.wangxiaolu.promotion.pojo.activity.planv2.response.ActivityResponse;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto; import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto; import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
import com.wangxiaolu.promotion.result.basedata.R; import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activity.examine.ExaPlanQueryService;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockQueryService; import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityClockQueryService;
import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService; import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityQueryService;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanQueryService; import com.wangxiaolu.promotion.service.activityplanv2.PromPlanQueryService;
...@@ -34,6 +36,8 @@ public class PromPlanQueryController { ...@@ -34,6 +36,8 @@ public class PromPlanQueryController {
private TemporaryActivityClockQueryService temporaryActivityClockQueryService; private TemporaryActivityClockQueryService temporaryActivityClockQueryService;
@Autowired @Autowired
private TemporaryActivityQueryService temporaryActivityQueryService; private TemporaryActivityQueryService temporaryActivityQueryService;
@Autowired
private ExaPlanQueryService exaPlanQueryService;
@PostMapping("/page") @PostMapping("/page")
public R queryPage(@RequestBody PageInfo pageInfo){ public R queryPage(@RequestBody PageInfo pageInfo){
...@@ -47,6 +51,9 @@ public class PromPlanQueryController { ...@@ -47,6 +51,9 @@ public class PromPlanQueryController {
@GetMapping("/{id}") @GetMapping("/{id}")
public R queryPlanById(@PathParam("id") @PathVariable Long id){ public R queryPlanById(@PathParam("id") @PathVariable Long id){
ActivityResponse activityResponse = promPlanQueryService.queryPlanById(id); ActivityResponse activityResponse = promPlanQueryService.queryPlanById(id);
ActivityExamineDto examineDto = exaPlanQueryService.selectByPlanId(id);
activityResponse.setExamine(examineDto);
List<TemporaryActivityReportedDto> reportedDtos = temporaryActivityQueryService.findListByPlan(id); List<TemporaryActivityReportedDto> reportedDtos = temporaryActivityQueryService.findListByPlan(id);
if (CollectionUtil.isEmpty(reportedDtos)){ if (CollectionUtil.isEmpty(reportedDtos)){
return R.success(activityResponse); return R.success(activityResponse);
......
package com.wangxiaolu.promotion.domain.examine.dao;
import com.wangxiaolu.promotion.domain.examine.wrapperQo.ExamineWrapper;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
/**
* @author : liqiulin
* @date : 2025-04-02 14
* @describe :
*/
public interface ActivityExamineDao {
ActivityExamineDto selectById(Long id);
ActivityExamineDto selectByPlanId(Long planId);
void save(ActivityExamineDto examineDto);
void updateById(ActivityExamineDto examineDto);
void page(PageInfo pageInfo, ExamineWrapper wq);
}
package com.wangxiaolu.promotion.domain.examine.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangxiaolu.promotion.common.util.BeanUtils;
import com.wangxiaolu.promotion.domain.examine.dao.ActivityExamineDao;
import com.wangxiaolu.promotion.domain.examine.mapper.ActivityExamineMapper;
import com.wangxiaolu.promotion.domain.examine.mapper.entity.ActivityExamineDO;
import com.wangxiaolu.promotion.domain.examine.wrapperQo.ExamineWrapper;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2025-04-02 14
* @describe :
*/
@Service
public class ActivityExamineDaoImpl implements ActivityExamineDao {
@Autowired
private ActivityExamineMapper activityExamineMapper;
@Override
public ActivityExamineDto selectById(Long id) {
ActivityExamineDO activityExamineDO = activityExamineMapper.selectById(id);
return BeanUtils.transitionDto(activityExamineDO, ActivityExamineDto.class);
}
@Override
public ActivityExamineDto selectByPlanId(Long planId) {
ActivityExamineDO examineDO = activityExamineMapper.selectByPlanId(planId);
return BeanUtils.transitionDto(examineDO, ActivityExamineDto.class);
}
@Override
public void save(ActivityExamineDto examineDto) {
try {
ActivityExamineDO examineDO = new ActivityExamineDO();
BeanUtils.copyProperties(examineDto, examineDO);
arrayToStringByDo(examineDO, examineDto);
activityExamineMapper.insert(examineDO);
} catch (Exception e) {
String eMsg = e.getCause().getMessage();
if (eMsg.contains("for key 'plan_id_unique'")) {
throw new ParamException(RCode.DATA_HAVE_ERROR);
}
}
}
@Override
public void updateById(ActivityExamineDto examineDto) {
ActivityExamineDO examineDO = new ActivityExamineDO();
BeanUtils.copyProperties(examineDto,examineDO);
arrayToStringByDo(examineDO,examineDto);
activityExamineMapper.updateById(examineDO);
}
@Override
public void page(PageInfo pageInfo, ExamineWrapper wq) {
LambdaQueryWrapper<ActivityExamineDO> qw = buildWq(wq);
Page<ActivityExamineDO> page = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<ActivityExamineDO> doPage = activityExamineMapper.selectPage(page, qw);
pageInfo.pageCovert(doPage);
pageInfo.setRecords(doPage.getRecords());
}
private LambdaQueryWrapper<ActivityExamineDO> buildWq(ExamineWrapper wq){
LambdaQueryWrapper<ActivityExamineDO> qw = new LambdaQueryWrapper<>();
if (Objects.nonNull(wq.getEmployeeId())){
qw.eq(ActivityExamineDO::getEmployeeId,wq.getEmployeeId());
}
if (Objects.nonNull(wq.getCreateDate())){
qw.eq(ActivityExamineDO::getCreateDate,wq.getCreateDate());
}
return qw;
}
private void arrayToStringByDo(ActivityExamineDO examineDO,ActivityExamineDto examineDto){
examineDO.setReportedIds(JSONObject.toJSONString(examineDto.getReportedIds()));
examineDO.setClockIds(JSONObject.toJSONString(examineDto.getClockIds()));
examineDO.setTemWorkPhotos(JSONObject.toJSONString(examineDto.getTemWorkPhotos()));
examineDO.setPosPhotos(JSONObject.toJSONString(examineDto.getPosPhotos()));
}
}
package com.wangxiaolu.promotion.domain.examine.wrapperQo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author : liqiulin
* @date : 2025-04-03 13
* @describe :
*/
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Data
public class ExamineWrapper {
/**
* 主键id
*/
private Long id;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 稽查日期
*/
private Date createDate;
}
package com.wangxiaolu.promotion.pojo.activity.examine.dto;
import com.alibaba.fastjson2.JSONArray;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author : liqiulin
* @date : 2025-04-02 14
* @describe :
*/
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Data
public class ActivityExamineDto {
/**
* 主键id
*/
private Long id;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 员工工号
*/
private String employeeNo;
/**
* 计划ID
*/
private Long planId;
/**
* 上报ID
*/
private String reportedIds;
/**
* 打卡ID
*/
private String clockIds;
/**
* 所属战区名称
*/
private String deptQcOrgName;
/**
* 负责人姓名
*/
private String manageName;
/**
* 执行城市
*/
private String city;
/**
* 计划日期
*/
private Date planDate;
/**
* 系统名称
*/
private String lineName;
/**
* 门店名称
*/
private String storeName;
/**
* 经销商名称
*/
private String dealerName;
/**
* 活动模式
*/
private String pattern;
/**
* 创建日期
*/
private Date createDate;
/**
* 门头照
*/
private String storePicture;
/**
* 促销员人数
*/
private Integer temNum;
/**
* 地堆:是/否
*/
private String storeDd;
/**
* 促销员是否在岗:在岗/离岗
*/
private String temOnWork;
/**
* 话述:达标/未达标
*/
private String temHs;
/**
* 物料:齐全/缺少
*/
private String temWl;
/**
* 着装:达标/未达标
*/
private String temZz;
/**
* 工作取证照片
*/
private String temWorkPhotos;
/**
* 特陈照
*/
private String storeTcPhoto;
/**
* 主货架照
*/
private String storeZhjPhoto;
/**
* POS金额
*/
private BigDecimal posRmb;
/**
* pos照片
*/
private String posPhotos;
/**
*
*/
private Date createTime;
/**
*
*/
private Date modifyTime;
/**
* 创建人
*/
private String createBy;
/**
* 修改人
*/
private String modifyBy;
}
package com.wangxiaolu.promotion.pojo.activity.examine.vo;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author : liqiulin
* @date : 2025-04-02 15
* @describe :
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ExaPlanVo {
/**
* 主键id
*/
private Long id;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 员工工号
*/
private String employeeNo;
/**
* 计划ID
*/
private Long planId;
/**
* 上报ID
*/
private JSONArray reportedIds;
/**
* 打卡ID
*/
private JSONArray clockIds;
/**
* 所属战区名称
*/
private String deptQcOrgName;
/**
* 负责人姓名
*/
private String manageName;
/**
* 执行城市
*/
private String city;
/**
* 计划日期
*/
private Date planDate;
/**
* 系统名称
*/
private String lineName;
/**
* 门店名称
*/
private String storeName;
/**
* 经销商名称
*/
private String dealerName;
/**
* 活动模式
*/
private String pattern;
/**
* 门头照
*/
private String storePicture;
/**
* 促销员人数
*/
private Integer temNum;
/**
* 地堆:是/否
*/
private String storeDd;
/**
* 促销员是否在岗:在岗/离岗
*/
private String temOnWork;
/**
* 话述:达标/未达标
*/
private String temHs;
/**
* 物料:齐全/缺少
*/
private String temWl;
/**
* 着装:达标/未达标
*/
private String temZz;
/**
* 工作取证照片
*/
private JSONArray temWorkPhotos;
/**
* 特陈照
*/
private String storeTcPhoto;
/**
* 主货架照
*/
private String storeZhjPhoto;
/**
* POS金额
*/
private BigDecimal posRmb;
/**
* pos照片
*/
private JSONArray posPhotos;
/**
* 操作人
*/
private String operName;
}
package com.wangxiaolu.promotion.pojo.activity.planv2.response; package com.wangxiaolu.promotion.pojo.activity.planv2.response;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto; import com.wangxiaolu.promotion.pojo.activity.planv2.dto.ActivityPlanInfoDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto; import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryActivityReportedDto;
import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto; import com.wangxiaolu.promotion.pojo.activity.temporary.dto.TemporaryClockDto;
...@@ -25,6 +26,8 @@ public class ActivityResponse { ...@@ -25,6 +26,8 @@ public class ActivityResponse {
List<ActivityReported> reporteds; List<ActivityReported> reporteds;
ActivityExamineDto examine;
@JsonIgnore @JsonIgnore
List<TemporaryActivityReportedDto> reportedDtos; List<TemporaryActivityReportedDto> reportedDtos;
......
package com.wangxiaolu.promotion.service.activity.examine;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
/**
* @author : liqiulin
* @date : 2025-04-02 15
* @describe :
*/
public interface ExaPlanCoreService {
void save(ActivityExamineDto examineDto);
void updateById(ActivityExamineDto examineDto);
}
package com.wangxiaolu.promotion.service.activity.examine;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
/**
* @author : liqiulin
* @date : 2025-04-02 14
* @describe :
*/
public interface ExaPlanQueryService {
ActivityExamineDto selectById(Long id);
ActivityExamineDto selectByPlanId(Long planId);
void page(PageInfo pageInfo);
}
package com.wangxiaolu.promotion.service.activity.examine.impl;
import com.wangxiaolu.promotion.domain.examine.dao.ActivityExamineDao;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.service.activity.examine.ExaPlanCoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2025-04-02 15
* @describe :
*/
@Service
public class ExaPlanCoreServiceImpl implements ExaPlanCoreService {
@Autowired
private ActivityExamineDao activityExamineDao;
@Override
public void save(ActivityExamineDto examineDto) {
activityExamineDao.save(examineDto);
}
@Override
public void updateById(ActivityExamineDto examineDto) {
activityExamineDao.updateById(examineDto);
}
}
package com.wangxiaolu.promotion.service.activity.examine.impl;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.examine.dao.ActivityExamineDao;
import com.wangxiaolu.promotion.domain.examine.wrapperQo.ExamineWrapper;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.pojo.activity.examine.dto.ActivityExamineDto;
import com.wangxiaolu.promotion.service.activity.examine.ExaPlanQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2025-04-02 14
* @describe :
*/
@Service
public class ExaPlanQueryServiceImpl implements ExaPlanQueryService {
@Autowired
private ActivityExamineDao activityExamineDao;
@Override
public ActivityExamineDto selectById(Long id) {
return activityExamineDao.selectById(id);
}
@Override
public ActivityExamineDto selectByPlanId(Long planId) {
return activityExamineDao.selectByPlanId(planId);
}
@Override
public void page(PageInfo pageInfo) {
ExamineWrapper wq = JSONObject.parseObject(JSONObject.toJSONString(pageInfo.getQueryParams()), ExamineWrapper.class);
activityExamineDao.page(pageInfo,wq);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论