提交 372bb68b authored 作者: 李秋林's avatar 李秋林

城市经理角色:上报记录保存、解析excel中的数据进行保存、分页查询数据

上级 fbd93681
......@@ -239,6 +239,12 @@
<artifactId>java-uuid-generator</artifactId>
<version>${java-uuid-generator.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>${aliyun.oss.version}</version>
</dependency>
</dependencies>
<build>
......
......@@ -8,9 +8,11 @@ import com.wangxiaolu.promotion.service.activity.temporary.TemporaryActivityCloc
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.Objects;
/**
......@@ -33,7 +35,7 @@ public class TemporaryActivityClockQueryController {
@GetMapping("/{temporary_id}")
public R findTodayTemporaryClockByTemId(@PathVariable("temporary_id") Integer temporaryId) {
if (Objects.isNull(temporaryId) || temporaryId < 1){
throw new DataException(RCode.DATA_NOT_HAVE_ERROR,null);
throw new DataException(RCode.DATA_NOT_HAVE_ERROR);
}
TemporaryClockDto clockDto = temporaryActivityClockQueryService.findTodayTemporaryClockByTemId(temporaryId);
......@@ -50,7 +52,7 @@ public class TemporaryActivityClockQueryController {
@GetMapping("/date")
public R findTemporaryClockByTemIdAndDate(Integer temporaryId, String createDate) {
if (Objects.isNull(temporaryId) || temporaryId < 1 || StringUtils.isBlank(createDate)){
throw new DataException(RCode.DATA_NOT_HAVE_ERROR,null);
throw new DataException(RCode.DATA_NOT_HAVE_ERROR);
}
TemporaryClockDto clockDto = temporaryActivityClockQueryService.findTemporaryClockByTemIdAndDate(temporaryId, createDate);
......@@ -63,7 +65,7 @@ public class TemporaryActivityClockQueryController {
@GetMapping("/id")
public R findTemporaryClockByTemIdAndDate(Long id) {
if (Objects.isNull(id) || id < 1){
throw new DataException(RCode.DATA_NOT_HAVE_ERROR,null);
throw new DataException(RCode.DATA_NOT_HAVE_ERROR);
}
TemporaryClockDto clockDto = temporaryActivityClockQueryService.findById(id);
return R.success(clockDto);
......
package com.wangxiaolu.promotion.controller.activityplanv2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanCoreService;
import com.wangxiaolu.promotion.service.user.ManageEmployeeQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author : liqiulin
......@@ -14,14 +20,46 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/plan/v2/core")
public class PromPlanCoreController {
@Autowired
private PromPlanCoreService promPlanCoreService;
@Autowired
private ManageEmployeeQueryService manageEmployeeQueryService;
/**
* 城市经理 - 上传计划
* 当月只能上传次月的新增(当月需要新增需要交由职能角色上传)
*/
@GetMapping("/self/upload")
public void selfPlan() {
@PostMapping("/self/upload")
public R selfPlan(@RequestBody ActivityPlanVo activityPlanVo) {
// 判断当前账号是否是城市经理
boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeId());
if (!isSelf) {
throw new DataException(RCode.EMP_PRIVILEGE_ERROR);
}
try {
String[] urlArr = activityPlanVo.getExcelUrl().split("weda-uploader/");
String fileId = urlArr[urlArr.length - 1];
if (fileId.length() > 53) {
throw new DataException(RCode.ACTIVITY_PLAN_FILENAME_LONG);
}
//todo String filePath = "/home/" + fileId;
// FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
String filePath = "/Users/a02200059/Desktop/测试新增v3.xlsx";
activityPlanVo.setExcelId(fileId);
Map<String, Object> map = promPlanCoreService.selfPlanUp(activityPlanVo, filePath);
return R.success(map);
} catch (DataException e) {
return new R(e.getCode(), e.getMsg(), null);
}
}
@GetMapping("/self/upload/{uuid}")
public R selfPlanAf(@PathVariable("uuid") String planUuid){
promPlanCoreService.selfPlanAf(planUuid);
return R.success();
}
/**
......
package com.wangxiaolu.promotion.controller.activityplanv2;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanQueryService;
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;
/**
* @author : liqiulin
* @date : 2025-02-06 16
* @describe :
*/
@RestController
@RequestMapping("/plan/v2/query")
public class PromPlanQueryController {
@Autowired
private PromPlanQueryService promPlanQueryService;
@PostMapping("/page")
public R queryPage(@RequestBody PageInfo pageInfo){
promPlanQueryService.queryPage(pageInfo);
return R.success(pageInfo);
}
}
package com.wangxiaolu.promotion.controller.yun;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.wangxiaolu.promotion.result.basedata.R;
import com.wangxiaolu.promotion.utils.AliyunUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author : liqiulin
* @date : 2025-02-06 13
* @describe :
*/
@Slf4j
@RestController
@RequestMapping("/user/aliyun/")
public class AliyunGetToken {
@Autowired
private AliyunUtils aliyunUtils;
@GetMapping("/signature")
public R getSignature() {
try {
return R.success(aliyunUtils.getSignature());
}catch (JsonProcessingException e){
return R.fail();
}
}
}
package com.wangxiaolu.promotion.controller.user;
package com.wangxiaolu.promotion.controller.yun;
import com.wangxiaolu.promotion.exception.ParamException;
import com.wangxiaolu.promotion.result.basedata.R;
......
......@@ -24,4 +24,6 @@ public interface ManageEmployeeInfoDao {
boolean hasByEmpNo(String employeeNo);
void updateAccount(String employeeNo, Integer privilegeId, String status);
boolean isOneSelf(Integer employeeId);
}
......@@ -87,6 +87,11 @@ public class ManageEmployeeInfoInfoDaoImpl implements ManageEmployeeInfoDao {
updatePrivilege(employeeNo,privilegeId);
}
@Override
public boolean isOneSelf(Integer employeeId) {
return manageEmployeeInfoMapper.isOneSelf(employeeId);
}
/**
* 增加权限
*/
......
......@@ -27,6 +27,8 @@ public interface ManageEmployeeInfoMapper extends BaseMapper<ManageEmployeeInfoD
void updateByEmployeeNo(@Param("employeeNo") String employeeNo,@Param("status") String status);
void updatePrivilege(@Param("employeeNo") String employeeNo,@Param("privilegeId") Integer privilegeId);
boolean isOneSelf(Integer employeeId);
}
......
package com.wangxiaolu.promotion.domain.activityplanv2.dao;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.pojo.PageInfo;
/**
* @author : liqiulin
* @date : 2025-02-06 11
* @describe :
*/
public interface ActivityPlanInfoDao {
void saveList(JSONArray table, Long recordId);
void page(PageInfo pageInfo, ActivityPlanInfoWrapper wrapper);
}
package com.wangxiaolu.promotion.domain.activityplanv2.dao;
import com.alibaba.fastjson.JSONObject;
/**
* @author : liqiulin
* @date : 2025-02-06 11
* @describe :
*/
public interface ActivityPlanRecordDao {
Long save(JSONObject record);
}
package com.wangxiaolu.promotion.domain.activityplanv2.dao.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangxiaolu.promotion.common.enums.StatusType;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanInfoMapper;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo;
import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.result.basedata.RCode;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.exceptions.PersistenceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2025-02-06 11
* @describe :
*/
@Service
public class ActivityPlanInfoDaoImpl implements ActivityPlanInfoDao {
@Autowired
private ActivityPlanInfoMapper activityPlanInfoMapper;
@Override
public void saveList(JSONArray table, Long recordId) {
try {
activityPlanInfoMapper.saveList(table, recordId);
} catch (PersistenceException e) {
e.printStackTrace();
throw new DataException(RCode.ACTIVITY_PLAN_REPETITION_ERROR);
}
}
@Override
public void page(PageInfo pageInfo, ActivityPlanInfoWrapper wrapper) {
LambdaQueryWrapper<ActivityPlanInfoDo> qw = buildWrapper(wrapper);
Page<ActivityPlanInfoDo> page = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<ActivityPlanInfoDo> doPage = activityPlanInfoMapper.selectPage(page, qw);
pageInfo.pageCovert(doPage);
pageInfo.setRecords(doPage.getRecords());
}
private LambdaQueryWrapper<ActivityPlanInfoDo> buildWrapper(ActivityPlanInfoWrapper wrapper) {
LambdaQueryWrapper<ActivityPlanInfoDo> qw = new LambdaQueryWrapper<>();
if (Objects.nonNull(wrapper.getEmployeeId())) {
qw.eq(ActivityPlanInfoDo::getEmployeeId, wrapper.getEmployeeId());
}
if (Objects.nonNull(wrapper.getActivityPlanRecordId())) {
qw.eq(ActivityPlanInfoDo::getPlanFileId, wrapper.getActivityPlanRecordId());
}
if (StringUtils.isNotBlank(wrapper.getDealerName())) {
qw.like(ActivityPlanInfoDo::getDealerName, wrapper.getDealerName());
}
if (StringUtils.isNotBlank(wrapper.getCity())) {
qw.like(ActivityPlanInfoDo::getCity, wrapper.getCity());
}
if (StringUtils.isNotBlank(wrapper.getStoreNameLike())) {
qw.like(ActivityPlanInfoDo::getStoreName, wrapper.getStoreNameLike());
}
if (StringUtils.isNotBlank(wrapper.getStoreName())) {
qw.eq(ActivityPlanInfoDo::getStoreName, wrapper.getStoreName());
}
if (Objects.nonNull(wrapper.getActivityStatus())) {
qw.eq(ActivityPlanInfoDo::getPlanStatus, wrapper.getActivityStatus().getType());
}
qw.between(ActivityPlanInfoDo::getDate, wrapper.getActivityStartDate(), wrapper.getActivityEndDate());
qw.eq(ActivityPlanInfoDo::getIsDelete, StatusType.VALID.getType());
qw.orderByDesc(ActivityPlanInfoDo::getCreateTime);
return qw;
}
}
package com.wangxiaolu.promotion.domain.activityplanv2.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanRecordMapper;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanRecordDo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2025-02-06 11
* @describe :
*/
@Service
public class ActivityPlanRecordDaoImpl implements ActivityPlanRecordDao {
@Autowired
private ActivityPlanRecordMapper activityPlanRecordMapper;
@Override
public Long save(JSONObject record) {
ActivityPlanRecordDo activityPlanRecordDo = JSONObject.parseObject(record.toJSONString(), ActivityPlanRecordDo.class);
activityPlanRecordMapper.insert(activityPlanRecordDo);
return activityPlanRecordDo.getId();
}
}
package com.wangxiaolu.promotion.domain.activityplanv2.mapper;
import com.alibaba.fastjson.JSONArray;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【activity_plan_info(活动计划列表)】的数据库操作Mapper
* @createDate 2025-01-21 14:41:08
* @Entity com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfo
*/
@Mapper
@Repository
public interface ActivityPlanInfoMapper extends BaseMapper<ActivityPlanInfoDo> {
void saveList(@Param("table") JSONArray table,@Param("recordId") Long recordId);
}
package com.wangxiaolu.promotion.domain.activityplanv2.mapper;
import com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanRecordDo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【activity_plan_record(活动计划店铺excel导入记录)】的数据库操作Mapper
* @createDate 2025-02-05 11:51:57
* @Entity com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanRecord
*/
@Mapper
@Repository
public interface ActivityPlanRecordMapper extends BaseMapper<ActivityPlanRecordDo> {
}
package com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* 活动计划列表
* @TableName activity_plan_info
*/
@TableName(value ="activity_plan_info")
@Data
public class ActivityPlanInfoDo implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* 活动计划表上传记录id
*/
private Long planFileId;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 员工工号
*/
private String employeeNo;
/**
* 年份
*/
private Integer year;
/**
* 月份
*/
private Integer month;
/**
* 日期
*/
private Date date;
/**
* 系统名称
*/
private String lineName;
/**
* 门店名称
*/
private String storeName;
/**
* 门店编码
*/
private String storeCode;
/**
* 战区-勤策ID
*/
private String orgQcId;
/**
* 战区名称
*/
private String orgName;
/**
* 活动模式id
*/
private Integer patternId;
/**
* 活动模式
*/
private String pattern;
/**
* 经销商编码
*/
private String dealerId;
/**
* 经销商名称
*/
private String dealerName;
/**
* 是否双T门店
*/
private String bothT;
/**
* 门店所属行政区域-省份名称,如:北京市、江苏省
*/
private String province;
/**
* 门店所属行政区域-城市名称,如:南京市
*/
private String city;
/**
* 门店所属行政区域-区县名称,如:鼓楼区
*/
private String area;
/**
* 门店所属行政区域-乡镇街道名称,如:宁海路街道
*/
private String street;
/**
* 门店所在地址
*/
private String addr;
/**
* 上班时间
*/
private Date clockInTime;
/**
* 下班时间
*/
private Date clockOutTime;
/**
* 工资
*/
private BigDecimal salary;
/**
* 杂费
*/
private BigDecimal incidentals;
/**
* 是否执行:1:执行;0:未执行;
*/
private Integer planStatus;
/**
*
*/
private Date createTime;
/**
*
*/
private Date modifyTime;
/**
* 1:有效;0:删除;
*/
private Integer isDelete;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 活动计划店铺excel导入记录
* @TableName activity_plan_record
*/
@TableName(value ="activity_plan_record")
@Data
public class ActivityPlanRecordDo implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 员工工号
*/
private String employeeNo;
/**
* 文件http地址
*/
private String excelUrl;
/**
* 文件ID(云存储中的id)
*/
private String excelFiledId;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
/**
* 1:有效;0:删除;
*/
private Integer isDelete;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -45,6 +45,11 @@ public class ActivityPlanInfoWrapper {
*/
private Date activityStartDate;
/**
* 活动结束日期
*/
private Date activityEndDate;
/**
* 城市
*/
......
......@@ -97,9 +97,14 @@ public class QinCeClienteleStoreDaoImpl implements QinCeClienteleStoreDao {
// 指定字段查询
qw.select(QinCeClienteleStoreDO::getQcId,
QinCeClienteleStoreDO::getStoreName,
QinCeClienteleStoreDO::getStoreAddr,
QinCeClienteleStoreDO::getDealersName,
QinCeClienteleStoreDO::getDealerId);
QinCeClienteleStoreDO::getDealerId,
QinCeClienteleStoreDO::getLineName,
QinCeClienteleStoreDO::getStoreMssProvince,
QinCeClienteleStoreDO::getStoreMssCity,
QinCeClienteleStoreDO::getStoreMssArea,
QinCeClienteleStoreDO::getStoreAddr
);
QinCeClienteleStoreDO qinCeClienteleStoreDO = qinCeClienteleStoreMapper.selectOne(qw);
return transitionDto(qinCeClienteleStoreDO);
......
package com.wangxiaolu.promotion.pojo.activity.manage.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Objects;
/**
* 活动计划
*/
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Data
public class ActivityPlanInfoDto implements Serializable {
/**
* 主键id
*/
private Long id;
/**
* 活动计划表上传记录id
*/
private Long planFileId;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 员工工号
*/
private String employeeNo;
/**
* 年份
*/
private Integer year;
/**
* 月份
*/
private Integer month;
/**
* 日期
*/
private Date date;
/**
* 系统名称
*/
private String lineName;
/**
* 门店名称
*/
private String storeName;
/**
* 门店编码
*/
private String storeCode;
/**
* 战区-勤策ID
*/
private String orgQcId;
/**
* 战区名称
*/
private String orgName;
/**
* 活动模式id
*/
private Integer patternId;
/**
* 活动模式
*/
private String pattern;
/**
* 经销商编码
*/
private String dealerId;
/**
* 经销商名称
*/
private String dealerName;
/**
* 是否双T门店
*/
private String bothT;
/**
* 门店所属行政区域-省份名称,如:北京市、江苏省
*/
private String province;
/**
* 门店所属行政区域-城市名称,如:南京市
*/
private String city;
/**
* 门店所属行政区域-区县名称,如:鼓楼区
*/
private String area;
/**
* 门店所在地址
*/
private String addr;
/**
* 上班时间
*/
private LocalDateTime clockInTime;
/**
* 下班时间
*/
private LocalDateTime clockOutTime;
/**
* 工资
*/
private BigDecimal salary;
/**
* 杂费
*/
private BigDecimal incidentals;
/**
* 是否执行:1:执行;0:未执行;
*/
private Integer planStatus;
private Integer index;
/**
* 当前行错误,不可保存
* 错误信息
*/
private String errorMsg;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
public void setErrorMsg(String errorMsg) {
if (Objects.isNull(this.errorMsg)) {
this.errorMsg = errorMsg;
} else {
this.errorMsg += errorMsg;
}
}
}
\ No newline at end of file
package com.wangxiaolu.promotion.pojo.activity.manage.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 活动计划店铺excel导入记录
*/
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Data
public class ActivityPlanRecordDto implements Serializable {
/**
* 主键id
*/
private Long id;
/**
* promotion_manage_employee表id
*/
private Integer employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 员工工号
*/
private String employeeNo;
/**
* 文件http地址
*/
private String excelUrl;
/**
* 文件ID(云存储中的id)
*/
private String excelFiledId;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
/**
* 1:有效;0:删除;
*/
private Integer isDelete;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -35,25 +35,8 @@ public class ActivityPlanVo {
* 文件http地址
*/
private String excelUrl;
/**
* 活动月份YYYY-MM
*/
// private String activityMonth;
/**
* 月份第几周
*/
// private Integer monthWeekNumber;
/**
* 月结束日期
*/
// private Date monthStartDate;
/**
* 月结束日期
*/
// private Date monthEndDate;
private String excelId;
private Integer originalEmpId;
private Integer transferEmpId;
......
......@@ -15,15 +15,13 @@ import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class QinCeClienteleStoreDto {
/**
* 勤策的门店唯一ID
*/
private String qcId;
private String storeName;
private String storeAddr;
private String dealersName;
private String dealerId;
private String lineName;
private String storeMssProvince;
private String storeMssCity;
private String storeMssArea;
private String storeAddr;
}
package com.wangxiaolu.promotion.service.activity.manage.impl;
import cn.hutool.core.util.ObjectUtil;
import com.wangxiaolu.promotion.common.excel.FileUtils;
import com.wangxiaolu.promotion.common.excel.ReadExcelUtils;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
......@@ -82,7 +83,7 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
private void saveActivityPlanInfo(ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
// 下载
String filePath = "/home/" + planDto.getExcelFiledId();
downloadExcel(activityPlanVo.getExcelUrl(), filePath);
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// 读取
List<EmployeeActivityPlanInfoDto> planInfoDtos = readSheet0(filePath, activityPlanVo, planDto);
......@@ -90,21 +91,21 @@ public class ActivityPlanRecordCoreServiceImpl implements ActivityPlanRecordCore
employeeActivityPlanInfoDao.saveList(planInfoDtos);
}
private void downloadExcel(String urlStr, String filePath) throws Exception {
// 保存文件
URL url = new URL(urlStr);
URLConnection urlConnection = url.openConnection();
InputStream inputStream = urlConnection.getInputStream();
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
// 调大小
byte[] buffer = new byte[102400];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
fileOutputStream.write(buffer, 0, bytesRead);
}
fileOutputStream.close();
inputStream.close();
}
// private void downloadExcel(String urlStr, String filePath) throws Exception {
// // 保存文件
// URL url = new URL(urlStr);
// URLConnection urlConnection = url.openConnection();
// InputStream inputStream = urlConnection.getInputStream();
// FileOutputStream fileOutputStream = new FileOutputStream(filePath);
// // 调大小
// byte[] buffer = new byte[102400];
// int bytesRead;
// while ((bytesRead = inputStream.read(buffer)) != -1) {
// fileOutputStream.write(buffer, 0, bytesRead);
// }
// fileOutputStream.close();
// inputStream.close();
// }
private List<EmployeeActivityPlanInfoDto> readSheet0(String filePath, ActivityPlanVo activityPlanVo, EmployeeActivityPlanRecordDto planDto) throws Exception {
// 1、解析表格数据
......
package com.wangxiaolu.promotion.service.activityplanv2;
import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2025-01-21 13
* @describe :
*/
public interface PromPlanCoreService {
Map<String,Object> selfPlanUp(ActivityPlanVo activityPlanVo, String filePath) throws DataException;
void selfPlanAf(String planUuid);
}
package com.wangxiaolu.promotion.service.activityplanv2;
import com.wangxiaolu.promotion.pojo.PageInfo;
/**
* @author : liqiulin
* @date : 2025-02-06 16
* @describe :
*/
public interface PromPlanQueryService {
void queryPage(PageInfo pageInfo);
}
package com.wangxiaolu.promotion.service.activityplanv2.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.common.excel.ReadExcelUtils;
import com.wangxiaolu.promotion.common.redis.RedisKeys;
import com.wangxiaolu.promotion.common.redis.service.RedisCache;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanRecordDao;
import com.wangxiaolu.promotion.domain.user.dao.QinCeClienteleStoreDao;
import com.wangxiaolu.promotion.domain.user.wrapperQo.StoreWrapper;
import com.wangxiaolu.promotion.exception.DataException;
import com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanInfoDto;
import com.wangxiaolu.promotion.pojo.activity.manage.dto.ActivityPlanRecordDto;
import com.wangxiaolu.promotion.pojo.activity.manage.vo.ActivityPlanVo;
import com.wangxiaolu.promotion.pojo.user.dto.QinCeClienteleStoreDto;
import com.wangxiaolu.promotion.result.basedata.RCode;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanCoreService;
import com.wangxiaolu.promotion.utils.DateUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.*;
import java.util.*;
/**
* @author : liqiulin
* @date : 2025-01-21 13
* @describe :
*/
@Service
public class PromPlanCoreServiceImpl implements PromPlanCoreService {
@Autowired
private QinCeClienteleStoreDao qinCeClienteleStoreDao;
@Autowired
private ActivityPlanRecordDao activityPlanRecordDao;
@Autowired
private ActivityPlanInfoDao activityPlanInfoDao;
@Autowired
private RedisCache redisCache;
@Override
public Map<String, Object> selfPlanUp(ActivityPlanVo planVo, String filePath) throws DataException {
// 1、解析活动计划文件是否符合规范
Map<String, Object> map = readSheetByCSJLUp(planVo, filePath);
if (!map.containsKey("uuid")){
return map;
}
// 2、生成uuid并关联上传记录
ActivityPlanRecordDto record = new ActivityPlanRecordDto()
.setEmployeeId(planVo.getEmployeeId())
.setEmployeeName(planVo.getEmployeeName())
.setEmployeeNo(planVo.getEmployeeNo())
.setExcelUrl(planVo.getExcelUrl())
.setExcelFiledId(planVo.getExcelId());
map.put("record", record);
// 保存到缓存(uuid)
redisCache.addToJsonToMinute(RedisKeys.Manage.ACTIVITY_PLAN_UP.getKey()+map.get("uuid").toString(),map,30);
// 返回结果
return map;
}
@Transactional(rollbackFor = Exception.class)
@Override
public void selfPlanAf(String planUuid) {
JSONObject mapJson = redisCache.getToJson(RedisKeys.Manage.ACTIVITY_PLAN_UP.getKey() + planUuid);
if (Objects.isNull(mapJson)){
throw new DataException(RCode.REDIS_PUSH_DATA_NOT_EXIT);
}
JSONObject record = mapJson.getJSONObject("record");
JSONArray table = mapJson.getJSONArray("table");
// 保存上传记录
Long recordId = activityPlanRecordDao.save(record);
activityPlanInfoDao.saveList(table,recordId);
}
private Map<String, Object> readSheetByCSJLUp(ActivityPlanVo planVo, String filePath) throws DataException {
ReadExcelUtils readExcelUtils = new ReadExcelUtils(filePath);
String[] headers = readExcelUtils.readTitle();
Map<Integer, List<Object>> rows = readExcelUtils.readContent();
if (headers.length != 10) {
throw new DataException(RCode.ACTIVITY_PLAN_TEM_ERROR);
}
if (CollectionUtil.isEmpty(rows)) {
throw new DataException(RCode.DATA_NOT_HAVE_ERROR);
}
boolean isEmpty = false;
ArrayList<Integer> indexList = new ArrayList<>();
for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) {
List<Object> cells = row.getValue();
// 判断当前行是否有任一数据为空,如果有则报错,不进行解析
isEmpty = (cells.size() != 10) || cells.stream().anyMatch(cell -> ObjectUtil.isNull(cell) || StringUtils.isBlank(cell.toString()));
if (isEmpty) {
indexList.add(row.getKey() + 1);
}
}
if (isEmpty) {
throw new DataException(RCode.ACTIVITY_PLAN_CELL_NOT_NULL, indexList);
}
Map<String, Object> rMap = new HashMap<>();
rMap.put("uuid", UUID.randomUUID().toString());
List<ActivityPlanInfoDto> rDtos = new ArrayList<>(rows.size() * 2);
for (Map.Entry<Integer, List<Object>> row : rows.entrySet()) {
List<ActivityPlanInfoDto> infoDtos = getRowByCSJLUp(planVo, row.getValue(),rMap);
rDtos.addAll(infoDtos);
}
rMap.put("table", rDtos);
return rMap;
}
/**
* 城市经理上传的计划工号只能是自己
*
* @param row 表中的每一行数据
* @return
*/
private List<ActivityPlanInfoDto> getRowByCSJLUp(ActivityPlanVo planVo, List<Object> row,Map<String, Object> rMap) {
List<ActivityPlanInfoDto> dtos = new ArrayList<>();
/**
* 5:多日期
*/
String days = row.get(5).toString();
String[] dayArr = days.split("、");
for (int i = 0; i < dayArr.length; i++) {
ActivityPlanInfoDto dto = new ActivityPlanInfoDto();
try {
String dayStr = dayArr[i];
int day = Integer.parseInt(dayStr);
/**
* 0:工号
*/
Object empNoO = row.get(0);
if (!planVo.getEmployeeNo().equals(empNoO.toString())) {
dto.setErrorMsg("请填写您自己的工号;");
} else {
dto.setEmployeeId(planVo.getEmployeeId());
dto.setEmployeeNo(planVo.getEmployeeNo());
dto.setEmployeeName(planVo.getEmployeeName());
}
/**
* 1:门店编码
*/
String sc = row.get(1).toString();
StoreWrapper storeWrap = new StoreWrapper().setStoreCode(sc);
QinCeClienteleStoreDto storeDto = qinCeClienteleStoreDao.getOneStore(storeWrap);
if (ObjectUtil.isEmpty(storeDto)) {
dto.setErrorMsg("门店编码错误;");
} else {
// todo 门店一定有系统名称?
dto.setLineName(storeDto.getLineName());
dto.setStoreCode(sc);
dto.setStoreName(storeDto.getStoreName());
dto.setDealerId(storeDto.getDealerId());
dto.setDealerName(storeDto.getDealersName());
dto.setProvince(storeDto.getStoreMssProvince());
dto.setCity(storeDto.getStoreMssCity());
dto.setArea(storeDto.getStoreMssArea());
dto.setAddr(storeDto.getStoreAddr());
}
/**
* 3:活动模式
*/
String pattern = row.get(3).toString();
if ("单点CP,常规MINI秀,校园活动".contains(pattern)) {
dto.setPattern(pattern);
} else {
dto.setErrorMsg("活动模式分为:单点CP、常规MINI秀、校园活动;");
}
/**
* 4:月份
* 年份 todo 以后判断是否跨年
*/
int year = DateUtil.thisYear();
Month month = Month.of(Integer.parseInt(row.get(4).toString()));
LocalDate planDate = LocalDate.of(year, month, day);
dto.setYear(year).setMonth(planDate.getMonthValue()).setDate(DateUtils.parseDateBylocalDate(planDate));
if (planDate.isBefore(LocalDate.now())) {
dto.setErrorMsg("不能是过去日期;");
}
/**
* 6:促销员上班时间
*/
LocalTime inLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(6).toString());
/**
* 7:促销员下班时间
*/
LocalTime outLocalTime = DateUtils.parseLocalTimeByEmdtime(row.get(7).toString());
if (ObjectUtils.anyNull(inLocalTime, outLocalTime)) {
dto.setErrorMsg("上下班时间必填;");
}
if (ObjectUtils.allNotNull(inLocalTime, outLocalTime) && inLocalTime.isAfter(outLocalTime)) {
dto.setErrorMsg("下班时间需晚于上班时间;");
} else {
dto.setClockInTime(LocalDateTime.of(planDate, inLocalTime));
dto.setClockOutTime(LocalDateTime.of(planDate, outLocalTime));
}
// 8:工资
dto.setSalary(new BigDecimal(row.get(8).toString()));
// 9:杂费
dto.setIncidentals(new BigDecimal(row.get(9).toString()));
} catch (DateTimeException e) {
dto.setErrorMsg("月份、日期、时间需要调整;");
}
if (StringUtils.isNotBlank(dto.getErrorMsg())){
rMap.remove("uuid");
}
dtos.add(dto);
}
return dtos;
}
}
package com.wangxiaolu.promotion.service.activityplanv2.impl;
import com.alibaba.fastjson.JSONObject;
import com.wangxiaolu.promotion.domain.activityplanv2.dao.ActivityPlanInfoDao;
import com.wangxiaolu.promotion.domain.manage.wrapperQo.ActivityPlanInfoWrapper;
import com.wangxiaolu.promotion.pojo.PageInfo;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author : liqiulin
* @date : 2025-02-06 16
* @describe :
*/
@Service
public class PromPlanQueryServiceImpl implements PromPlanQueryService {
@Autowired
private ActivityPlanInfoDao activityPlanInfoDao;
@Override
public void queryPage(PageInfo pageInfo) {
ActivityPlanInfoWrapper wrapper = JSONObject.parseObject(JSONObject.toJSONString(pageInfo.getQueryParams()), ActivityPlanInfoWrapper.class);
activityPlanInfoDao.page(pageInfo,wrapper);
}
}
......@@ -21,4 +21,6 @@ public interface ManageEmployeeQueryService {
List<ManageEmployeeInfoDto> findList(ManageEmployeeVo manageEmployeeVo);
boolean hasByEmpNo(String employeeNo);
boolean isOneSelf(Integer employeeId);
}
......@@ -57,4 +57,9 @@ public class ManageEmployeeQueryServiceImpl implements ManageEmployeeQueryServic
public boolean hasByEmpNo(String employeeNo) {
return manageEmployeeInfoDao.hasByEmpNo(employeeNo);
}
@Override
public boolean isOneSelf(Integer employeeId) {
return manageEmployeeInfoDao.isOneSelf(employeeId);
}
}
package com.wangxiaolu.promotion.utils;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.common.utils.BinaryUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.binary.Base64;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.auth.sts.AssumeRoleRequest;
import com.aliyuncs.auth.sts.AssumeRoleResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2025-02-06 13
* @describe :
*/
@Component
public class AliyunUtils {
@Value("${aliyun.access-key-id}")
private String OSS_ACCESS_KEY_ID;
@Value("${aliyun.access-key-secret}")
private String OSS_ACCESS_KEY_SECRET;
@Value("${aliyun.oss.sts-role-arm}")
private String OSS_STS_ROLE_ARN;
@Value("${aliyun.oss.region-id}")
private String REGION_ID;
@Value("${aliyun.oss.session-name}")
private String YOUR_ROLE_SESSION_NAME;
@Value("${aliyun.oss.bucket-name}")
private String BUCKET_NAME;
@Value("${aliyun.oss.web-js-link}")
private String WEB_JS_LIN;
public JSONObject getSignature() throws JsonProcessingException {
//获取发送STS请求基础信息
//环境变量中获取access_key_id
String accessKeyId = OSS_ACCESS_KEY_ID;
//环境变量中获取access_key_secret
String accessKeySecret = OSS_ACCESS_KEY_SECRET;
//环境变量中获取ARN
String roleArnForOssUpload = OSS_STS_ROLE_ARN;
//色会话名称,用来区分不同的令牌,可自定义
String roleSessionName = YOUR_ROLE_SESSION_NAME;
//临时访问凭证的有效时间
Long durationSeconds = 3600L;
//初始化客户端
DefaultProfile profile = DefaultProfile.getProfile(REGION_ID, accessKeyId, accessKeySecret);
IAcsClient client = new DefaultAcsClient(profile);
AssumeRoleRequest request = new AssumeRoleRequest();
request.setRoleArn(roleArnForOssUpload);
request.setRoleSessionName(roleSessionName);
request.setDurationSeconds(durationSeconds);
//定义STS临时访问凭证变量
String STSaccessKeyId = null;
String STSsecretAccessKey = null;
String securityToken = null;
try {
AssumeRoleResponse response = client.getAcsResponse(request);
//将请求返回的STS临时访问凭证赋值到自定义变量中
STSaccessKeyId = response.getCredentials().getAccessKeyId();
STSsecretAccessKey = response.getCredentials().getAccessKeySecret();
securityToken = response.getCredentials().getSecurityToken();
} catch (ClientException e) {
e.printStackTrace();
}
//格式化请求日期
long now = System.currentTimeMillis() / 1000;
ZonedDateTime dtObj = ZonedDateTime.ofInstant(Instant.ofEpochSecond(now), ZoneId.of("UTC"));
ZonedDateTime dtObjPlus3h = dtObj.plusHours(3);
//请求时间
DateTimeFormatter dtObj1Formatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'");
String dtObj1 = dtObj.format(dtObj1Formatter);
//请求日期
DateTimeFormatter dtObj2Formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
String dtObj2 = dtObj.format(dtObj2Formatter);
//请求过期时间
DateTimeFormatter expirationTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
String expirationTime = dtObjPlus3h.format(expirationTimeFormatter);
// 创建policy
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> policy = new HashMap<>();
policy.put("expiration", expirationTime);
List<Object> conditions = new ArrayList<>();
Map<String, String> bucketCondition = new HashMap<>();
bucketCondition.put("bucket", BUCKET_NAME); //请替换为目标bucket名称
conditions.add(bucketCondition);
Map<String, String> signatureVersionCondition = new HashMap<>();
signatureVersionCondition.put("x-oss-signature-version", "OSS4-HMAC-SHA256");
conditions.add(signatureVersionCondition);
Map<String, String> credentialCondition = new HashMap<>();
// 替换为实际的 access key id
credentialCondition.put("x-oss-credential", STSaccessKeyId + "/" + dtObj2 + "/"+REGION_ID+"/oss/aliyun_v4_request");
conditions.add(credentialCondition);
Map<String, String> token = new HashMap<>();
token.put("x-oss-security-token", securityToken);
conditions.add(token);
Map<String, String> dateCondition = new HashMap<>();
dateCondition.put("x-oss-date", dtObj1);
conditions.add(dateCondition);
policy.put("conditions", conditions);
String jsonPolicy = mapper.writeValueAsString(policy);
//构造待签名字符串(StringToSign)
String stringToSign = new String(Base64.encodeBase64(jsonPolicy.getBytes()));
//计算SigningKey
byte[] dateKey = hmacsha256(("aliyun_v4" + STSsecretAccessKey).getBytes(), dtObj2);
byte[] dateRegionKey = hmacsha256(dateKey, REGION_ID);
byte[] dateRegionServiceKey = hmacsha256(dateRegionKey, "oss");
byte[] signingKey = hmacsha256(dateRegionServiceKey, "aliyun_v4_request");
//计算Signature
byte[] result = hmacsha256(signingKey, stringToSign);
String signature = BinaryUtil.toHex(result);
Map<String, String> messageMap = new HashMap<>();
messageMap.put("security_token", securityToken);
messageMap.put("signature", signature);
messageMap.put("x_oss_date", dtObj1);
messageMap.put("x_oss_credential", STSaccessKeyId + "/" + dtObj2 + "/"+REGION_ID+"/oss/aliyun_v4_request");
messageMap.put("x_oss_signature_version", "OSS4-HMAC-SHA256");
messageMap.put("policy", stringToSign);
messageMap.put("web_js_link", WEB_JS_LIN);
ObjectMapper objectMapper = new ObjectMapper();
String signatureStr = objectMapper.writeValueAsString(messageMap);
return JSONObject.parseObject(signatureStr);
}
/**
* 使用HMAC-SHA256算法计算给定密钥和数据的哈希值的静态方法
*
* @param key
* @param data
* @return
*/
public static byte[] hmacsha256(byte[] key, String data) {
try {
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "HmacSHA256");
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(secretKeySpec);
byte[] hmacBytes = mac.doFinal(data.getBytes());
return hmacBytes;
} catch (Exception e) {
throw new RuntimeException("Failed to calculate HMAC-SHA256", e);
}
}
}
\ No newline at end of file
......@@ -2,10 +2,14 @@ package com.wangxiaolu.promotion.utils;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;
/**
* @author : liqiulin
......@@ -29,4 +33,21 @@ public class DateUtils {
throw new RuntimeException(e);
}
}
public static LocalTime parseLocalTimeByEmdtime(String emdtimeStr) {
if (StringUtils.isBlank(emdtimeStr)) {
return null;
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
return LocalTime.parse(emdtimeStr, formatter);
}
public static Date parseDateBylocalDate(LocalDate localDate) {
if (localDate == null) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
Instant instant = zonedDateTime.toInstant();
return Date.from(instant);
}
}
......@@ -92,4 +92,14 @@ xxl:
logretentiondays: 30
address:
ip:
logpath: /Users/a02200059/Desktop/wangxiaolu-sfa/log/xxl_job # 执行器日志路径
\ No newline at end of file
logpath: /Users/a02200059/Desktop/wangxiaolu-sfa/log/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-dev-miniapp
bucket-name: link-promotion-dev
web-js-link: link-promotion-dev.oss-cn-shanghai.aliyuncs.com
\ No newline at end of file
......@@ -84,4 +84,15 @@ xxl:
logretentiondays: 30
address:
ip:
logpath: /var/logs/xxl_job # 执行器日志路径
\ No newline at end of file
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
......@@ -66,4 +66,9 @@
privilege = (select privilege from manage_ref_privilege where id = #{privilegeId})
where employee_id = (select id from manage_employee_info where employee_no = #{employeeNo});
</update>
<select id="isOneSelf" resultType="boolean">
select count(*) > 0
from manage_employee_ref_privilege where employee_id = #{employeeId} and privilege_id = 1;
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanInfoMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="planFileId" column="plan_file_id" jdbcType="BIGINT"/>
<result property="employeeId" column="employee_id" jdbcType="INTEGER"/>
<result property="employeeName" column="employee_name" jdbcType="VARCHAR"/>
<result property="employeeNo" column="employee_no" jdbcType="VARCHAR"/>
<result property="year" column="year" jdbcType="INTEGER"/>
<result property="month" column="month" jdbcType="INTEGER"/>
<result property="date" column="date" jdbcType="DATE"/>
<result property="lineName" column="line_name" jdbcType="VARCHAR"/>
<result property="storeName" column="store_name" jdbcType="VARCHAR"/>
<result property="storeCode" column="store_code" jdbcType="VARCHAR"/>
<result property="orgQcId" column="org_qc_id" jdbcType="VARCHAR"/>
<result property="orgName" column="org_name" jdbcType="VARCHAR"/>
<result property="patternId" column="pattern_id" jdbcType="INTEGER"/>
<result property="pattern" column="pattern" jdbcType="VARCHAR"/>
<result property="dealerId" column="dealer_id" jdbcType="VARCHAR"/>
<result property="dealerName" column="dealer_name" jdbcType="VARCHAR"/>
<result property="bothT" column="both_t" jdbcType="VARCHAR"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="area" column="area" jdbcType="VARCHAR"/>
<result property="street" column="street" jdbcType="VARCHAR"/>
<result property="addr" column="addr" jdbcType="VARCHAR"/>
<result property="planStatus" column="plan_status" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,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,
street,addr,plan_status,
create_time,modify_time,is_delete
</sql>
<insert id="saveList">
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,street,addr,clock_in_time,clock_out_time,salary,incidentals)
VALUES
<foreach collection="table" item="item" index="index" separator=",">
(#{recordId}, #{item.employeeId}, #{item.employeeName}, #{item.employeeNo}, #{item.year},
#{item.month}, FROM_UNIXTIME(#{item.date} / 1000), #{item.lineName}, #{item.storeName}, #{item.storeCode},
'',
'', 0, #{item.pattern}, #{item.dealerId}, #{item.dealerName}, '未确定',
#{item.province}, #{item.city}, #{item.area}, #{item.street}, #{item.addr},
FROM_UNIXTIME(#{item.clockInTime} / 1000), FROM_UNIXTIME(#{item.clockOutTime} / 1000), #{item.salary},
#{item.incidentals})
</foreach>
</insert>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wangxiaolu.promotion.domain.activityplanv2.mapper.ActivityPlanRecordMapper">
<resultMap id="BaseResultMap" type="com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanRecordDo">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="employeeId" column="employee_id" jdbcType="INTEGER"/>
<result property="employeeName" column="employee_name" jdbcType="VARCHAR"/>
<result property="employeeNo" column="employee_no" jdbcType="VARCHAR"/>
<result property="excelUrl" column="excel_url" jdbcType="VARCHAR"/>
<result property="excelFiledId" column="excel_filed_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
<result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,employee_id,employee_name,
employee_no,excel_url,excel_filed_id,
create_time,modify_time,is_delete
</sql>
</mapper>
package com.wangxiaolu.promotion.service.activityplanv2.impl;
import com.wangxiaolu.promotion.service.activityplanv2.PromPlanCoreService;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @author : liqiulin
* @date : 2025-01-21 15
* @describe :
*/
@SpringBootTest
@RunWith(SpringRunner.class)
class PromPlanCoreServiceImplTest {
@Autowired
private PromPlanCoreService service;
@Test
void selfPlan() {
// service.selfPlan(null,"/Users/a02200059/Desktop/测试新增v3.xlsx");
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论