提交 33224724 authored 作者: 000516's avatar 000516

促销模板4.0新增午休/试吃/品类

上级 fd49b65c
...@@ -61,8 +61,10 @@ public class PromPlanCoreController { ...@@ -61,8 +61,10 @@ public class PromPlanCoreController {
try { try {
String[] urlArr = activityPlanVo.getExcelUrl().split("/"); String[] urlArr = activityPlanVo.getExcelUrl().split("/");
String fileId = urlArr[urlArr.length - 1]; String fileId = urlArr[urlArr.length - 1];
String filePath = "/root/promotion/planv2/" + fileId; //todo String filePath = "/root/promotion/planv2/" + fileId;
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath); //todo FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// todo
String filePath = activityPlanVo.getExcelUrl();
activityPlanVo.setExcelId(fileId); activityPlanVo.setExcelId(fileId);
Map<String, Object> map = promPlanCoreService.selfPlanUp(activityPlanVo, filePath); Map<String, Object> map = promPlanCoreService.selfPlanUp(activityPlanVo, filePath);
return R.success(map); return R.success(map);
...@@ -96,8 +98,10 @@ public class PromPlanCoreController { ...@@ -96,8 +98,10 @@ public class PromPlanCoreController {
try { try {
String[] urlArr = activityPlanVo.getExcelUrl().split("/"); String[] urlArr = activityPlanVo.getExcelUrl().split("/");
String fileId = urlArr[urlArr.length - 1]; String fileId = urlArr[urlArr.length - 1];
String filePath = "/root/promotion/planv2/" + fileId; //todo String filePath = "/root/promotion/planv2/" + fileId;
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath); //todo FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// todo
String filePath = activityPlanVo.getExcelUrl();
activityPlanVo.setExcelId(fileId); activityPlanVo.setExcelId(fileId);
Map<String, Object> map = promPlanCoreService.authPlanUp(activityPlanVo, filePath); Map<String, Object> map = promPlanCoreService.authPlanUp(activityPlanVo, filePath);
return R.success(map); return R.success(map);
...@@ -139,8 +143,10 @@ public class PromPlanCoreController { ...@@ -139,8 +143,10 @@ public class PromPlanCoreController {
try { try {
String[] urlArr = activityPlanVo.getExcelUrl().split("/"); String[] urlArr = activityPlanVo.getExcelUrl().split("/");
String fileId = urlArr[urlArr.length - 1]; String fileId = urlArr[urlArr.length - 1];
String filePath = "/root/promotion/planv2/" + fileId; //todo String filePath = "/root/promotion/planv2/" + fileId;
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath); //todo FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// todo
String filePath = activityPlanVo.getExcelUrl();
activityPlanVo.setExcelId(fileId); activityPlanVo.setExcelId(fileId);
Map<String, Object> map = promPlanCoreService.selfPlanPut(activityPlanVo, filePath); Map<String, Object> map = promPlanCoreService.selfPlanPut(activityPlanVo, filePath);
return R.success(map); return R.success(map);
......
package com.wangxiaolu.promotion.domain.activityplanv2.dao; package com.wangxiaolu.promotion.domain.activityplanv2.dao;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.enums.plan.OperationType;
/** /**
* @author : liqiulin * @author : liqiulin
...@@ -8,5 +9,5 @@ import com.alibaba.fastjson.JSONObject; ...@@ -8,5 +9,5 @@ import com.alibaba.fastjson.JSONObject;
* @describe : * @describe :
*/ */
public interface ActivityPlanRecordDao { public interface ActivityPlanRecordDao {
Long save(JSONObject record); Long save(JSONObject record, OperationType operationType);
} }
...@@ -69,7 +69,7 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao { ...@@ -69,7 +69,7 @@ public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao {
@Override @Override
public void updateById(ActivityPlanInfoDto planDto) { public void updateById(ActivityPlanInfoDto planDto) {
// todo 判断计划是否存在 // 判断计划是否存在
// ActivityPlanInfoDo activityPlanInfoDo = activityPlanInfoMapper.selectPlan(planDto.getStoreCode(), planDto.getDate()); // ActivityPlanInfoDo activityPlanInfoDo = activityPlanInfoMapper.selectPlan(planDto.getStoreCode(), planDto.getDate());
// if (Objects.isNull(activityPlanInfoDo)){ // if (Objects.isNull(activityPlanInfoDo)){
// throw new DataException(RCode.ACTIVITY_PLAN_IS_NULL); // throw new DataException(RCode.ACTIVITY_PLAN_IS_NULL);
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao; import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanRecordMapper; import com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanRecordMapper;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanRecordDo; import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanRecordDo;
import com.wangxiaolu.promotion.enums.plan.OperationType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,8 +20,9 @@ public class ActivityPlanRecordDaoImpl implements ActivityPlanRecordDao { ...@@ -19,8 +20,9 @@ public class ActivityPlanRecordDaoImpl implements ActivityPlanRecordDao {
private ActivityPlanRecordMapper activityPlanRecordMapper; private ActivityPlanRecordMapper activityPlanRecordMapper;
@Override @Override
public Long save(JSONObject record) { public Long save(JSONObject record,OperationType operationType) {
ActivityPlanRecordDo activityPlanRecordDo = JSONObject.parseObject(record.toJSONString(), ActivityPlanRecordDo.class); ActivityPlanRecordDo activityPlanRecordDo = JSONObject.parseObject(record.toJSONString(), ActivityPlanRecordDo.class);
activityPlanRecordDo.setOperationType(operationType);
activityPlanRecordMapper.insert(activityPlanRecordDo); activityPlanRecordMapper.insert(activityPlanRecordDo);
return activityPlanRecordDo.getId(); return activityPlanRecordDo.getId();
} }
......
...@@ -133,6 +133,15 @@ public class ActivityPlanInfoDo implements Serializable { ...@@ -133,6 +133,15 @@ public class ActivityPlanInfoDo implements Serializable {
*/ */
private LocalDateTime clockInTime; private LocalDateTime clockInTime;
/**
* 午休下班时间
*/
private LocalDateTime noonOutLocalTime;
/**
* 午休上班时间
*/
private LocalDateTime noonInLocalTime;
/** /**
* 下班时间 * 下班时间
*/ */
...@@ -141,12 +150,21 @@ public class ActivityPlanInfoDo implements Serializable { ...@@ -141,12 +150,21 @@ public class ActivityPlanInfoDo implements Serializable {
/** /**
* 工资 * 工资
*/ */
private BigDecimal salary; // private BigDecimal salary;
/** /**
* 杂费 * 杂费
*/ */
private BigDecimal incidentals; // private BigDecimal incidentals;
/**
* 是否有试吃台
*/
private String temWlSct;
/**
* 活动品项:老品/黑鸭/散称
*/
private String prdClass;
/** /**
* 是否执行:1:执行;0:未执行; * 是否执行:1:执行;0:未执行;
......
...@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import com.wangxiaolu.promotion.enums.plan.OperationType;
import lombok.Data; import lombok.Data;
/** /**
...@@ -46,16 +48,13 @@ public class ActivityPlanRecordDo implements Serializable { ...@@ -46,16 +48,13 @@ public class ActivityPlanRecordDo implements Serializable {
*/ */
private String excelFiledId; private String excelFiledId;
private OperationType operationType;
/** /**
* 创建时间 * 创建时间
*/ */
private Date createTime; private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
/** /**
* 1:有效;0:删除; * 1:有效;0:删除;
*/ */
......
...@@ -134,6 +134,14 @@ public class ActivityPlanInfoDto implements Serializable { ...@@ -134,6 +134,14 @@ public class ActivityPlanInfoDto implements Serializable {
* 上班时间 * 上班时间
*/ */
private LocalDateTime clockInTime; private LocalDateTime clockInTime;
/**
* 午休下班时间
*/
private LocalDateTime noonOutLocalTime;
/**
* 午休上班时间
*/
private LocalDateTime noonInLocalTime;
/** /**
* 下班时间 * 下班时间
...@@ -143,12 +151,20 @@ public class ActivityPlanInfoDto implements Serializable { ...@@ -143,12 +151,20 @@ public class ActivityPlanInfoDto implements Serializable {
/** /**
* 工资 * 工资
*/ */
private BigDecimal salary; // private BigDecimal salary;
/** /**
* 杂费 * 杂费
*/ */
private BigDecimal incidentals; // private BigDecimal incidentals;
/**
* 是否有试吃台
*/
private String temWlSct;
/**
* 活动品项:老品/黑鸭/散称
*/
private String prdClass;
/** /**
* 是否执行:1:执行;0:未执行; * 是否执行:1:执行;0:未执行;
......
...@@ -70,11 +70,11 @@ public class ActivityPlanOperVo { ...@@ -70,11 +70,11 @@ public class ActivityPlanOperVo {
/** /**
* 工资 * 工资
*/ */
private BigDecimal salary; // private BigDecimal salary;
/** /**
* 杂费 * 杂费
*/ */
private BigDecimal incidentals; // private BigDecimal incidentals;
private List<Long> planIds; private List<Long> planIds;
} }
...@@ -2,7 +2,6 @@ package com.wangxiaolu.promotion.service.activityplanv2.impl; ...@@ -2,7 +2,6 @@ package com.wangxiaolu.promotion.service.activityplanv2.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -34,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -34,7 +33,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.*; import java.time.*;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
import java.util.*; import java.util.*;
...@@ -93,19 +91,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -93,19 +91,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
String[] headers = readExcelUtils.readTitle(); String[] headers = readExcelUtils.readTitle();
Map<Integer, List<Object>> rows = readExcelUtils.readContent(); Map<Integer, List<Object>> rows = readExcelUtils.readContent();
if (headers.length != 10) { if (headers.length != 12) {
throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR); throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR);
} }
if (CollectionUtil.isEmpty(rows)) { if (CollectionUtil.isEmpty(rows)) {
throw new DataException(RCode.DATA_NOT_HAVE_ERROR); throw new DataException(RCode.READ_EXCEL_NULL_ERROR);
} }
boolean isEmpty = false;
ArrayList<Integer> indexList = new ArrayList<>(); ArrayList<Integer> indexList = new ArrayList<>();
for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) { for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) {
List<Object> cells = row.getValue(); List<Object> cells = row.getValue();
// 判断当前行是否有任一数据为空,如果有则报错,不进行解析 // 判断当前行是否有任一数据为空,如果有则报错,不进行解析
isEmpty = (cells.size() != 10) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString())); boolean isEmpty = (cells.size() != 12) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString()));
if (isEmpty) { if (isEmpty) {
indexList.add(row.getKey() + 1); indexList.add(row.getKey() + 1);
} }
...@@ -118,6 +115,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -118,6 +115,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
rMap.put("uuid", UUID.randomUUID().toString()); rMap.put("uuid", UUID.randomUUID().toString());
List<ActivityPlanInfoDto> rDtos = new ArrayList<>(rows.size() * 4); List<ActivityPlanInfoDto> rDtos = new ArrayList<>(rows.size() * 4);
// 循环每行
for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) { for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) {
List<ActivityPlanInfoDto> infoDtos = getRowByCSJLUp(planVo, row.getValue(),rMap); List<ActivityPlanInfoDto> infoDtos = getRowByCSJLUp(planVo, row.getValue(),rMap);
rDtos.addAll(infoDtos); rDtos.addAll(infoDtos);
...@@ -130,11 +128,12 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -130,11 +128,12 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
/** /**
* 城市经理 - 上传计划 * 城市经理 - 上传计划
* 循环每天
*/ */
private List<ActivityPlanInfoDto> getRowByCSJLUp(ActivityPlanVo planVo, List<Object> row,Map<String, Object> rMap) { private List<ActivityPlanInfoDto> getRowByCSJLUp(ActivityPlanVo planVo, List<Object> row,Map<String, Object> rMap) {
List<ActivityPlanInfoDto> dtos = new ArrayList<>(); List<ActivityPlanInfoDto> dtos = new ArrayList<>();
LocalDate now = LocalDate.now(); LocalDate now = LocalDate.now();
int monthValue = now.getMonthValue(); // int monthValue = now.getMonthValue();
int nextMonthValue = now.plusMonths(1).getMonthValue(); int nextMonthValue = now.plusMonths(1).getMonthValue();
/** /**
...@@ -198,7 +197,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -198,7 +197,7 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
/** /**
* 4:月份 新增逻辑只支持次月计划; * 4:月份 新增逻辑只支持次月计划;
* 6:促销员上班时间 当月份错误,促销员上下班时间也不进行计算 * 6:促销员上班时间 当月份错误则促销员上下班、午休下上班不进行计算
* 7:促销员下班时间 * 7:促销员下班时间
* 年份:当月份为1时,判定为跨年 * 年份:当月份为1时,判定为跨年
*/ */
...@@ -209,16 +208,14 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -209,16 +208,14 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
year += 1; year += 1;
} }
LocalDate planDate = LocalDate.of(year, month, day); LocalDate planDate = LocalDate.of(year, month, day);
// if (monthInt != nextMonthValue && monthInt != monthValue) { // if (monthInt != nextMonthValue && monthInt != monthValue) {
// dto.setErrorMsg("月份只能是当月或次月;"); // dto.setErrorMsg("月份只能是当月或次月;");
if (monthInt != nextMonthValue) { if (monthInt != nextMonthValue) {
dto.setErrorMsg("月份只能是次月;"); dto.setErrorMsg("月份只能是次月;");
} else if (planDate.isBefore(LocalDate.now())) { } else if (planDate.isBefore(LocalDate.now())) {
dto.setErrorMsg("日期不能是以前;"); dto.setErrorMsg("日期不能是以前;");
} else { } else {
// 上、下班时间
dto.setYear(year).setMonth(planDate.getMonthValue()).setDate(DateUtils.parseDateBylocalDate(planDate)); dto.setYear(year).setMonth(planDate.getMonthValue()).setDate(DateUtils.parseDateBylocalDate(planDate));
LocalTime inLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(6).toString()); LocalTime inLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(6).toString());
LocalTime outLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(7).toString()); LocalTime outLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(7).toString());
...@@ -230,13 +227,50 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -230,13 +227,50 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
} else { } else {
dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime)); dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime));
dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime)); dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime));
// 午休时间:上班时间<午休下班时间<午休上班时间<下班时间
LocalTime noonOutLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(8).toString());
LocalTime noonInLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(9).toString());
if (ObjectUtils.allNotNull(noonOutLocalTime, noonInLocalTime)
&& inLocalTime.isBefore(noonOutLocalTime)
&& noonOutLocalTime.isBefore(noonInLocalTime)
&& noonInLocalTime.isBefore(outLocalTime))
{
dto.setNoonOutLocalTime(LocalDateTime.of(planDate, noonOutLocalTime));
dto.setNoonInLocalTime(LocalDateTime.of(planDate, noonInLocalTime));
}else if (ObjectUtils.allNotNull(noonOutLocalTime, noonInLocalTime)){
dto.setErrorMsg("时间错误,正确规则:上班时间<午休下班时间<午休上班时间<下班时间;");
}
} }
} }
// 8:工资
dto.setSalary(new BigDecimal(row.get(8).toString())); /**
// 9:杂费 * 10:是否有促销台/试吃台
dto.setIncidentals(new BigDecimal(row.get(9).toString())); */
String temWlSct = row.get(10).toString();
if ("有,无".contains(temWlSct)) {
dto.setTemWlSct(temWlSct);
} else {
dto.setErrorMsg("是否有促销台请填写:有、无;");
}
/**
* 11:活动品项
*/
String prdClass = row.get(11).toString();
if ("黑鸭,散称,老品".contains(prdClass)) {
dto.setPrdClass(prdClass);
} else {
dto.setErrorMsg("活动品项请填写:黑鸭、散称、老品;");
}
// 作废:工资
// dto.setSalary(new BigDecimal(row.get(8).toString()));
// 作废:杂费
// dto.setIncidentals(new BigDecimal(row.get(9).toString()));
// 判断计划是否已存在 // 判断计划是否已存在
ActivityPlanInfoDto hasDto = activityPlanInfoDao.selectPlan(dto.getStoreCode(), dto.getDate()); ActivityPlanInfoDto hasDto = activityPlanInfoDao.selectPlan(dto.getStoreCode(), dto.getDate());
...@@ -290,19 +324,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -290,19 +324,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
String[] headers = readExcelUtils.readTitle(); String[] headers = readExcelUtils.readTitle();
Map<Integer, List<Object>> rows = readExcelUtils.readContent(); Map<Integer, List<Object>> rows = readExcelUtils.readContent();
if (headers.length != 10) { if (headers.length != 12) {
throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR); throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR);
} }
if (CollectionUtil.isEmpty(rows)) { if (CollectionUtil.isEmpty(rows)) {
throw new DataException(RCode.DATA_NOT_HAVE_ERROR); throw new DataException(RCode.READ_EXCEL_NULL_ERROR);
} }
boolean isEmpty = false;
ArrayList<Integer> indexList = new ArrayList<>(); ArrayList<Integer> indexList = new ArrayList<>();
for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) { for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) {
List<Object> cells = row.getValue(); List<Object> cells = row.getValue();
// 判断当前行是否有任一数据为空,如果有则报错,不进行解析 // 判断当前行是否有任一数据为空,如果有则报错,不进行解析
isEmpty = (cells.size() != 10) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString())); boolean isEmpty = (cells.size() != 12) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString()));
if (isEmpty) { if (isEmpty) {
indexList.add(row.getKey() + 1); indexList.add(row.getKey() + 1);
} }
...@@ -427,13 +460,48 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -427,13 +460,48 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
} else { } else {
dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime)); dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime));
dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime)); dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime));
// 午休时间:上班时间<午休下班时间<午休上班时间<下班时间
LocalTime noonOutLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(8).toString());
LocalTime noonInLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(9).toString());
if (ObjectUtils.allNotNull(noonOutLocalTime, noonInLocalTime)
&& inLocalTime.isBefore(noonOutLocalTime)
&& noonOutLocalTime.isBefore(noonInLocalTime)
&& noonInLocalTime.isBefore(outLocalTime))
{
dto.setNoonOutLocalTime(LocalDateTime.of(planDate, noonOutLocalTime));
dto.setNoonInLocalTime(LocalDateTime.of(planDate, noonInLocalTime));
}else {
dto.setErrorMsg("时间错误,正确规则:上班时间<午休下班时间<午休上班时间<下班时间;");
}
} }
} }
/**
* 10:是否有促销台/试吃台
*/
String temWlSct = row.get(10).toString();
if ("有,无".contains(temWlSct)) {
dto.setTemWlSct(temWlSct);
} else {
dto.setErrorMsg("是否有促销台请填写:有、无;");
}
/**
* 11:活动品项
*/
String prdClass = row.get(11).toString();
if ("黑鸭,散称,老品".contains(prdClass)) {
dto.setPrdClass(prdClass);
} else {
dto.setErrorMsg("活动品项请填写:黑鸭、散称、老品;");
}
// 8:工资 // 8:工资
dto.setSalary(new BigDecimal(row.get(8).toString())); // dto.setSalary(new BigDecimal(row.get(8).toString()));
// 9:杂费 // 9:杂费
dto.setIncidentals(new BigDecimal(row.get(9).toString())); // dto.setIncidentals(new BigDecimal(row.get(9).toString()));
// 判断计划是否已存在 // 判断计划是否已存在
ActivityPlanInfoDto hasDto = activityPlanInfoDao.selectPlan(dto.getStoreCode(), dto.getDate()); ActivityPlanInfoDto hasDto = activityPlanInfoDao.selectPlan(dto.getStoreCode(), dto.getDate());
...@@ -532,8 +600,6 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -532,8 +600,6 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
.setPattern(operVo.getPattern()) .setPattern(operVo.getPattern())
.setClockInTime(operVo.getClockInTime()) .setClockInTime(operVo.getClockInTime())
.setClockOutTime(operVo.getClockOutTime()) .setClockOutTime(operVo.getClockOutTime())
.setSalary(operVo.getSalary())
.setIncidentals(operVo.getIncidentals())
.setModifyBy(operVo.getOperName()); .setModifyBy(operVo.getOperName());
activityPlanInfoDao.updateById(planDto); activityPlanInfoDao.updateById(planDto);
} }
...@@ -566,8 +632,6 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -566,8 +632,6 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
.setAddr(storeDto.getStoreAddr()) .setAddr(storeDto.getStoreAddr())
.setClockInTime(operVo.getClockInTime()) .setClockInTime(operVo.getClockInTime())
.setClockOutTime(operVo.getClockOutTime()) .setClockOutTime(operVo.getClockOutTime())
.setSalary(operVo.getSalary())
.setIncidentals(operVo.getIncidentals())
.setCreateBy(operVo.getOperName()); .setCreateBy(operVo.getOperName());
activityPlanInfoDao.save(planDto); activityPlanInfoDao.save(planDto);
} }
...@@ -598,19 +662,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -598,19 +662,18 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
String[] headers = readExcelUtils.readTitle(); String[] headers = readExcelUtils.readTitle();
Map<Integer, List<Object>> rows = readExcelUtils.readContent(); Map<Integer, List<Object>> rows = readExcelUtils.readContent();
if (headers.length != 10) { if (headers.length != 12) {
throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR); throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR);
} }
if (CollectionUtil.isEmpty(rows)) { if (CollectionUtil.isEmpty(rows)) {
throw new DataException(RCode.DATA_NOT_HAVE_ERROR); throw new DataException(RCode.READ_EXCEL_NULL_ERROR);
} }
boolean isEmpty = false;
ArrayList<Integer> indexList = new ArrayList<>(); ArrayList<Integer> indexList = new ArrayList<>();
for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) { for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) {
List<Object> cells = row.getValue(); List<Object> cells = row.getValue();
// 判断当前行是否有任一数据为空,如果有则报错,不进行解析 // 判断当前行是否有任一数据为空,如果有则报错,不进行解析
isEmpty = (cells.size() != 10) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString())); boolean isEmpty = (cells.size() != 12) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString()));
if (isEmpty) { if (isEmpty) {
indexList.add(row.getKey() + 1); indexList.add(row.getKey() + 1);
} }
...@@ -710,7 +773,24 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -710,7 +773,24 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
} else { } else {
dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime)); dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime));
dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime)); dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime));
// 午休时间:上班时间<午休下班时间<午休上班时间<下班时间
LocalTime noonOutLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(8).toString());
LocalTime noonInLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(9).toString());
if (ObjectUtils.allNotNull(noonOutLocalTime, noonInLocalTime)
&& inLocalTime.isBefore(noonOutLocalTime)
&& noonOutLocalTime.isBefore(noonInLocalTime)
&& noonInLocalTime.isBefore(outLocalTime))
{
dto.setNoonOutLocalTime(LocalDateTime.of(planDate, noonOutLocalTime));
dto.setNoonInLocalTime(LocalDateTime.of(planDate, noonInLocalTime));
}else {
dto.setErrorMsg("时间错误,正确规则:上班时间<午休下班时间<午休上班时间<下班时间;");
}
} }
// 促销员上班时间顺延1小时内,可修改
if (LocalDateTime.now().isAfter(hasDto.getClockInTime().plusHours(1))){ if (LocalDateTime.now().isAfter(hasDto.getClockInTime().plusHours(1))){
dto.setErrorMsg("已超促销员上班时间1小时,不可修改;"); dto.setErrorMsg("已超促销员上班时间1小时,不可修改;");
} }
...@@ -725,10 +805,30 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -725,10 +805,30 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
dto.setErrorMsg("活动模式分为:单点CP、常规MINI秀、校园活动;"); dto.setErrorMsg("活动模式分为:单点CP、常规MINI秀、校园活动;");
} }
/**
* 10:是否有促销台/试吃台
*/
String temWlSct = row.get(10).toString();
if ("有,无".contains(temWlSct)) {
dto.setTemWlSct(temWlSct);
} else {
dto.setErrorMsg("是否有促销台请填写:有、无;");
}
/**
* 11:活动品项
*/
String prdClass = row.get(11).toString();
if ("黑鸭,散称,老品".contains(prdClass)) {
dto.setPrdClass(prdClass);
} else {
dto.setErrorMsg("活动品项请填写:黑鸭、散称、老品;");
}
// 8:工资 // 8:工资
dto.setSalary(new BigDecimal(row.get(8).toString())); // dto.setSalary(new BigDecimal(row.get(8).toString()));
// 9:杂费 // 9:杂费
dto.setIncidentals(new BigDecimal(row.get(9).toString())); // dto.setIncidentals(new BigDecimal(row.get(9).toString()));
} catch (DateTimeException e) { } catch (DateTimeException e) {
dto.setErrorMsg("月份、日期、时间需要调整;"); dto.setErrorMsg("月份、日期、时间需要调整;");
...@@ -758,10 +858,10 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService { ...@@ -758,10 +858,10 @@ public class PromPlanCoreServiceImpl implements PromPlanCoreService {
String type = mapJson.getString("type"); String type = mapJson.getString("type");
if (OperationType.UP.getCode().equals(type)) { if (OperationType.UP.getCode().equals(type)) {
// 保存上传记录 // 保存上传记录
Long recordId = activityPlanRecordDao.save(record); Long recordId = activityPlanRecordDao.save(record,OperationType.UP);
activityPlanInfoDao.saveList(table, recordId); activityPlanInfoDao.saveList(table, recordId);
} else if (OperationType.PUT.getCode().equals(type)) { } else if (OperationType.PUT.getCode().equals(type)) {
Long recordId = activityPlanRecordDao.save(record); Long recordId = activityPlanRecordDao.save(record,OperationType.PUT);
activityPlanInfoDao.updateList(table, recordId); activityPlanInfoDao.updateList(table, recordId);
} }
} }
......
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.0.18:3306/promotion?autoReconnect=true
username: NvqGbJXH
password: D9Y@FR,84B*$MD^A36&m
redis:
port: 6379
host: 111.198.15.68
database: 1
password: QjL6H5nH
main:
web-application-type: reactive
cloud:
nacos:
discovery:
server-addr: 192.168.0.2:8848
namespace: 5a4d4bfc-5297-4c6f-b475-0a6ae838d8d9
group: promotion
logging:
config: classpath:logback-spring.xml
async:
executor:
thread:
core_pool_size: 4
name:
prefix: promotion-
wx:
miniapp:
configs:
- appid: wxac14dc7765484d7d
secret: e73b574380a822c942e03ea4dc67aaa1
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
temporary:
token_secret: sXwHPj#U#xmim^ts
employee:
token_secret: xZq%kXASSPD$UtL
cx_miniapp:
app_id: wxac14dc7765484d7d
app_secret: e73b574380a822c942e03ea4dc67aaa1
tengxunyun:
# 腾讯云个人账号信息
secret_d: AKIDVt353sWyY0GXn0ANa0YyGdwDIBtjQwGS
secret_key: SBqJcrxypSxeGOPF81mLgsANXo3ALhz7
sms:
#指定接入地域域名,默认就近地域接入域名为 sms.tencentcloudapi.com
endpoint_beijing: sms.ap-beijing.tencentcloudapi.com
#地域信息
ap_beijing: ap-beijing
#应用ID(默认应用)
sdk_app_id_defult: 1400903035
#签名内容
sign_name_a: 北京王小卤
#模板ID
template_id_a: 2127434
#验证码过期时间(分钟)
overdue_long: 5
qince:
open_api: https://openapi.region2.qince.com
open_id: 8546408787259919799
app_key: oV0FHfMt81Tii2_kst
# mybatis-plus 打印sql日志
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
# xxl-job配置
xxl:
job:
accessToken: default_token
admin:
addresses: http://192.168.0.2:9001/xxl-job-admin
executor:
appname: promotion-live
port: 9998
logretentiondays: 30
address:
ip: 192.168.0.4
logpath: /var/logs/xxl_job # 执行器日志路径
aliyun:
access-key-id: LTAI5tEvDG8hMRf9tBt9kB3s
access-key-secret: TnH1qRJr95t62pNcVLNopeEhpPxiqe
oss:
region-id: cn-shanghai
sts-role-arm: acs:ram::1819206190412770:role/oss-admin-role
session-name: promotion-live-miniapp
bucket-name: link-promotion
web-js-link: link-promotion.oss-cn-shanghai.aliyuncs.com
\ No newline at end of file
...@@ -68,15 +68,15 @@ ...@@ -68,15 +68,15 @@
<insert id="saveList"> <insert id="saveList">
INSERT INTO activity_plan_info INSERT INTO activity_plan_info
(plan_file_id,employee_id,employee_name,employee_no,year,month,date,line_name,store_name,store_code,org_qc_id,org_name,pattern_id,pattern,dealer_id,dealer_name,both_t,province,city,area,addr,clock_in_time,clock_out_time,salary,incidentals,create_by) (plan_file_id,employee_id,employee_name,employee_no,year,month,date,line_name,store_name,store_code,org_qc_id,org_name,pattern_id,pattern,dealer_id,dealer_name,both_t,province,city,area,addr,clock_in_time,clock_out_time,noon_clock_out_time,noon_clock_in_time,tem_wl_sct,prd_class,create_by)
VALUES VALUES
<foreach collection="table" item="item" index="index" separator=","> <foreach collection="table" item="item" index="index" separator=",">
(#{recordId}, #{item.employeeId}, #{item.employeeName}, #{item.employeeNo}, #{item.year}, (#{recordId}, #{item.employeeId}, #{item.employeeName}, #{item.employeeNo}, #{item.year},
#{item.month}, FROM_UNIXTIME(#{item.date} / 1000), #{item.lineName}, #{item.storeName}, #{item.storeCode}, #{item.month}, FROM_UNIXTIME(#{item.date} / 1000), #{item.lineName}, #{item.storeName}, #{item.storeCode},
#{item.orgQcId},#{item.orgName}, 0, #{item.pattern}, #{item.dealerId}, #{item.dealerName}, '未确定', #{item.orgQcId},#{item.orgName}, 0, #{item.pattern}, #{item.dealerId}, #{item.dealerName}, '未确定',
#{item.province}, #{item.city}, #{item.area}, #{item.addr}, #{item.province}, #{item.city}, #{item.area}, #{item.addr},
FROM_UNIXTIME(#{item.clockInTime} / 1000), FROM_UNIXTIME(#{item.clockOutTime} / 1000), #{item.salary}, FROM_UNIXTIME(#{item.clockInTime} / 1000), FROM_UNIXTIME(#{item.clockOutTime} / 1000), FROM_UNIXTIME(#{item.noonOutLocalTime} / 1000),
#{item.incidentals},#{item.createBy}) FROM_UNIXTIME(#{item.noonInLocalTime} / 1000),#{item.temWlSct},#{item.prdClass},#{item.createBy})
</foreach> </foreach>
</insert> </insert>
...@@ -143,8 +143,10 @@ ...@@ -143,8 +143,10 @@
dealer_name = #{pDo.dealerName}, dealer_name = #{pDo.dealerName},
clock_in_time = #{pDo.clockInTime}, clock_in_time = #{pDo.clockInTime},
clock_out_time = #{pDo.clockOutTime}, clock_out_time = #{pDo.clockOutTime},
salary = #{pDo.salary}, noon_clock_out_time = #{pDo.noonOutLocalTime},
incidentals = #{pDo.incidentals}, noon_clock_in_time = #{pDo.noonInLocalTime},
tem_wl_sct = #{pDo.temWlSct},
prd_class = #{pDo.prdClass},
modify_by = #{pDo.modifyBy} modify_by = #{pDo.modifyBy}
where store_code = #{pDo.storeCode} where store_code = #{pDo.storeCode}
and date = #{pDo.date}; and date = #{pDo.date};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论