提交 0923f2be authored 作者: 李秋林's avatar 李秋林

修改计划逻辑;上传计划文件获取url中的文件名;

上级 764e15bd
...@@ -42,15 +42,11 @@ public class PromPlanCoreController { ...@@ -42,15 +42,11 @@ public class PromPlanCoreController {
} }
try { try {
String[] urlArr = activityPlanVo.getExcelUrl().split("weda-uploader/"); String[] urlArr = activityPlanVo.getExcelUrl().split("/");
String fileId = urlArr[urlArr.length - 1]; String fileId = urlArr[urlArr.length - 1];
if (fileId.length() > 53) { String filePath = "/root/promotion/planv2/" + fileId;
throw new DataException(RCode.ACTIVITY_PLAN_FILENAME_LONG); //todo String filePath = "/Users/a02200059/Desktop/2.0/" + fileId;
}
String filePath = "/home/" + fileId;
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath); FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
// todo String filePath = "/Users/a02200059/Desktop/测试新增v3 2.xlsx";
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);
...@@ -63,9 +59,31 @@ public class PromPlanCoreController { ...@@ -63,9 +59,31 @@ public class PromPlanCoreController {
/** /**
* todo 城市经理修改 * 城市经理修改
*/ */
@PutMapping("/self/put")
public R selfPlanPut(@RequestBody ActivityPlanVo activityPlanVo) {
// 判断当前账号是否是城市经理
boolean isSelf = manageEmployeeQueryService.isOneSelf(activityPlanVo.getEmployeeId());
if (!isSelf) {
throw new DataException(RCode.EMP_PRIVILEGE_ERROR);
}
try {
String[] urlArr = activityPlanVo.getExcelUrl().split("/");
String fileId = urlArr[urlArr.length - 1];
String filePath = "/root/promotion/planv2/" + fileId;
//todo String filePath = "/Users/a02200059/Desktop/2.0/" + fileId;
FileUtils.downloadExcel(activityPlanVo.getExcelUrl(), filePath);
activityPlanVo.setExcelId(fileId);
Map<String, Object> map = promPlanCoreService.selfPlanPut(activityPlanVo, filePath);
return R.success(map);
} catch (DataException e) {
return new R(e.getCode(), e.getMsg(), null);
} catch (Exception e) {
return R.fail();
}
}
......
package com.wangxiaolu.promotion.enums.plan;
/**
* @author : liqiulin
* @date : 2025-02-12 17
* @describe :
*/
public enum PlanStatus {
/**
* 是否执行:1:执行;0:未执行;
*/
EXECUTION(1, "执行"),
NOT_EXECUTION(0, "未执行");
private final Integer code;
private final String desc;
PlanStatus(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
}
...@@ -18,5 +18,7 @@ public interface PromPlanCoreService { ...@@ -18,5 +18,7 @@ public interface PromPlanCoreService {
void deletePlan(List<Long> planIds); void deletePlan(List<Long> planIds);
Map<String, Object> authPlanUp(ActivityPlanVo activityPlanVo, String filePath); Map<String, Object> authPlanUp(ActivityPlanVo activityPlanVo, String filePath) throws DataException;
Map<String, Object> selfPlanPut(ActivityPlanVo activityPlanVo, String filePath) throws DataException;
} }
...@@ -3,19 +3,18 @@ package com.wangxiaolu.promotion.utils; ...@@ -3,19 +3,18 @@ package com.wangxiaolu.promotion.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.common.utils.BinaryUtil; import com.aliyun.oss.common.utils.BinaryUtil;
import com.aliyun.sts20150401.models.AssumeRoleResponseBody; import com.aliyun.sts20150401.Client;
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.DefaultAcsClient;
import com.aliyuncs.IAcsClient; import com.aliyuncs.IAcsClient;
import com.aliyuncs.auth.sts.AssumeRoleRequest; import com.aliyuncs.auth.sts.AssumeRoleRequest;
import com.aliyuncs.auth.sts.AssumeRoleResponse; import com.aliyuncs.auth.sts.AssumeRoleResponse;
import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile; import com.aliyuncs.profile.DefaultProfile;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.aliyun.sts20150401.Client;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
......
...@@ -34,6 +34,16 @@ ...@@ -34,6 +34,16 @@
</resultMap> </resultMap>
<resultMap id="SimResultMap" type="com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="employeeName" column="employee_name" jdbcType="VARCHAR"/>
<result property="employeeNo" column="employee_no" jdbcType="VARCHAR"/>
<result property="province" column="province" 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"/>
</resultMap>
<resultMap id="PlanBase" type="com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo"> <resultMap id="PlanBase" type="com.wangxiaolu.promotion.domain.activityplanv2.mapper.entity.ActivityPlanInfoDo">
<id property="id" column="id" jdbcType="BIGINT"/> <id property="id" column="id" jdbcType="BIGINT"/>
<result property="employeeName" column="employee_name" jdbcType="VARCHAR"/> <result property="employeeName" column="employee_name" jdbcType="VARCHAR"/>
...@@ -66,8 +76,8 @@ ...@@ -66,8 +76,8 @@
</foreach> </foreach>
</insert> </insert>
<select id="selectPlan" resultMap="BaseResultMap"> <select id="selectPlan" resultMap="SimResultMap">
select employee_name, create_time select id,employee_name,employee_no,province,plan_status,create_time,modify_time
from activity_plan_info from activity_plan_info
where date = #{date} and store_code = #{storeCode} and is_delete = 1; where date = #{date} and store_code = #{storeCode} and is_delete = 1;
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论