Commit d314e7f4 by kk

刷数据:刷A+摄影的执行人

parent 0cbcc83d
......@@ -33,7 +33,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -107,33 +106,5 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
package cn.kk.spring_simple_operation.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 视觉操作日志 前端控制器
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@RestController
@RequestMapping("/spring_simple_operation/visual-design-log")
public class VisualDesignLogController {
}
package cn.kk.spring_simple_operation.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 视觉设计人员信息 前端控制器
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@RestController
@RequestMapping("/spring_simple_operation/visual-designer")
public class VisualDesignerController {
}
package cn.kk.spring_simple_operation.controller;
import cn.kk.spring_simple_operation.service.VisualPhotographerAPlusService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>
* 视觉设计协同系统-摄影A+ 前端控制器
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@RestController
@RequestMapping("/spring_simple_operation/visual-photographer-aplus")
public class VisualPhotographerAPlusController {
@Resource
private VisualPhotographerAPlusService visualPhotographerAPlusService;
@RequestMapping("/brushDataForExecutor")
public String brushDataForExecutor() {
visualPhotographerAPlusService.brushDataForExecutor();
return "ok";
}
}
package cn.kk.spring_simple_operation.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* <p>
* 视觉操作日志
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Getter
@Setter
@Accessors(chain = true)
@TableName("visual_design_log")
@ApiModel(value = "VisualDesignLog对象", description = "视觉操作日志")
public class VisualDesignLog implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId("id")
private Long id;
@ApiModelProperty("操作")
@TableField("operation_key")
private String operationKey;
@ApiModelProperty("创建时间")
@TableField("create_time")
private Integer createTime;
@ApiModelProperty("创建人id")
@TableField("create_id")
private Integer createId;
@ApiModelProperty("创建人")
@TableField("create_name")
private String createName;
@ApiModelProperty("操作内容")
@TableField("operation_content")
private String operationContent;
@ApiModelProperty("关联id")
@TableField("relation_id")
private Long relationId;
@ApiModelProperty("文件url")
@TableField("file_url")
private String fileUrl;
@ApiModelProperty("操作字段")
@TableField("operation_type")
private String operationType;
@ApiModelProperty("审核状态")
@TableField("audit_status")
private Integer auditStatus;
@ApiModelProperty("操作备注")
@TableField("operation_remark")
private String operationRemark;
}
package cn.kk.spring_simple_operation.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* <p>
* 视觉设计人员信息
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Getter
@Setter
@Accessors(chain = true)
@TableName("visual_designer")
@ApiModel(value = "VisualDesigner对象", description = "视觉设计人员信息")
public class VisualDesigner implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId("id")
private Long id;
@ApiModelProperty("用户id")
@TableField("user_id")
private Integer userId;
@ApiModelProperty("部门key")
@TableField("department_key")
private String departmentKey;
@ApiModelProperty("用户名称")
@TableField("user_name")
private String userName;
@ApiModelProperty("角色id")
@TableField("role_id")
private Integer roleId;
@ApiModelProperty("部门名称")
@TableField("department_name")
private String departmentName;
@ApiModelProperty("分组编号")
@TableField("group_number")
private String groupNumber;
@ApiModelProperty("职位")
@TableField("user_position")
private String userPosition;
@ApiModelProperty("编号")
@TableField("visual_number")
private String visualNumber;
@ApiModelProperty("等级")
@TableField("visual_level")
private String visualLevel;
@ApiModelProperty("管理部门(显示的字符串)")
@TableField("manage_department")
private String manageDepartment;
@ApiModelProperty("管理分组(显示的字符串)")
@TableField("manage_group")
private String manageGroup;
@ApiModelProperty("创建用户id")
@TableField("create_id")
private Integer createId;
@ApiModelProperty("创建用户")
@TableField("create_name")
private String createName;
@ApiModelProperty("创建时间")
@TableField("create_time")
private Integer createTime;
@ApiModelProperty("是否删除,0-否1-是")
@TableField("is_delete")
@TableLogic
private Integer isDelete;
@ApiModelProperty("负责的开发名称(显示的字符串,摄影负责开发)")
@TableField("develop_name")
private String developName;
@ApiModelProperty("负责的开发编号(显示的字符串,图案设计负责开发)")
@TableField("developer_num")
private String developerNum;
@ApiModelProperty("负责的账号(显示的字符串,策划负责账号)")
@TableField("account_name")
private String accountName;
@ApiModelProperty("摄影助理用户id")
@TableField("photographer_assistant")
private Integer photographerAssistant;
@ApiModelProperty("地区")
@TableField("region")
private String region;
@ApiModelProperty("地区(城市)")
@TableField("region_city")
private String regionCity;
@ApiModelProperty("摄影A+关联的传达设计人员编号,逗号分隔")
@TableField("communication_designer")
private String communicationDesigner;
@ApiModelProperty("摄影关联的策划人员编号,以英文逗号分隔")
@TableField("relevance_plan")
private String relevancePlan;
@ApiModelProperty("是否在摄影A+页面展示")
@TableField("is_show_in_a_plus")
private Integer isShowInAPlus;
@ApiModelProperty("是否为优秀设计师:0-否,1-是")
@TableField("is_excellent_designer")
private Integer isExcellentDesigner;
@ApiModelProperty("额度(若填了【可选设计师的开发】则展示,只可填正整数)")
@TableField("quota")
private Integer quota;
@ApiModelProperty("更新时间(用于数据同步)")
@TableField("update_at")
private LocalDateTime updateAt;
@ApiModelProperty("是否为剪辑师:0-否,1-是")
@TableField("is_editor")
private Integer isEditor;
@ApiModelProperty("是否在摄影视频页面展示:0-否,1-是")
@TableField("is_show_in_photographer")
private Integer isShowInPhotographer;
}
package cn.kk.spring_simple_operation.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
/**
* <p>
* 视觉设计协同系统-摄影A+
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Getter
@Setter
@Accessors(chain = true)
@TableName("visual_photographer_a_plus")
@ApiModel(value = "VisualPhotographerAPlus对象", description = "视觉设计协同系统-摄影A+")
public class VisualPhotographerAPlus implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("id")
@TableId("id")
private Long id;
@ApiModelProperty("sku")
@TableField("sku")
private String sku;
@ApiModelProperty("执行者编号")
@TableField("executor_number")
private String executorNumber;
@ApiModelProperty("执行者")
@TableField("executor_name")
private String executorName;
@ApiModelProperty("分配时间")
@TableField("distribution_time")
private Integer distributionTime;
@ApiModelProperty("完成状态,0-未完成,1-进行中,2-完成,3-不需要处理")
@TableField("`status`")
private Integer status;
@ApiModelProperty("完成时间")
@TableField("finish_time")
private Integer finishTime;
@ApiModelProperty("备注")
@TableField("remark")
private String remark;
@ApiModelProperty("创建时间")
@TableField("create_time")
private Integer createTime;
@ApiModelProperty("创建人")
@TableField("create_name")
private String createName;
@ApiModelProperty("创建人id")
@TableField("create_id")
private Integer createId;
@ApiModelProperty("A+表的id")
@TableField("ap_id")
private Long apId;
@ApiModelProperty("visual_a_plus_plan的id")
@TableField("a_plus_plan_id")
private Long aPlusPlanId;
@ApiModelProperty("文件链接")
@TableField("file_url")
private String fileUrl;
@ApiModelProperty("标签id")
@TableField("vdt_id")
private Long vdtId;
@ApiModelProperty("是否删除,0-否,1-是")
@TableField("is_delete")
@TableLogic
private Integer isDelete;
@ApiModelProperty("设计是否取样,0-否,1-是")
@TableField("is_take_sample")
private Integer isTakeSample;
@ApiModelProperty("取样时间,设计是否取样为是时,需要有值")
@TableField("take_sample_time")
private Integer takeSampleTime;
@ApiModelProperty("取样样品状态::1-正,2-次")
@TableField("take_sample_status")
private Integer takeSampleStatus;
@ApiModelProperty("取样样品备注")
@TableField("take_sample_status_remark")
private String takeSampleStatusRemark;
}
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.VisualDesignLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 视觉操作日志 Mapper 接口
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Mapper
public interface VisualDesignLogMapper extends BaseMapper<VisualDesignLog> {
}
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.VisualDesigner;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 视觉设计人员信息 Mapper 接口
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Mapper
public interface VisualDesignerMapper extends BaseMapper<VisualDesigner> {
VisualDesigner getDesignerByPlan(@Param("planNumber") String planNumber);
}
package cn.kk.spring_simple_operation.mapper;
import cn.kk.spring_simple_operation.entity.VisualPhotographerAPlus;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 视觉设计协同系统-摄影A+ Mapper 接口
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Mapper
public interface VisualPhotographerAPlusMapper extends BaseMapper<VisualPhotographerAPlus> {
List<VisualPhotographerAPlus> listNoExecutor();
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.VisualDesignLog;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 视觉操作日志 服务类
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
public interface VisualDesignLogService extends IService<VisualDesignLog> {
void addLog(String operationKey, String operationContent, Long relationId);
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.VisualDesigner;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 视觉设计人员信息 服务类
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
public interface VisualDesignerService extends IService<VisualDesigner> {
}
package cn.kk.spring_simple_operation.service;
import cn.kk.spring_simple_operation.entity.VisualPhotographerAPlus;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 视觉设计协同系统-摄影A+ 服务类
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
public interface VisualPhotographerAPlusService extends IService<VisualPhotographerAPlus> {
void brushDataForExecutor();
}
package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.VisualDesignLog;
import cn.kk.spring_simple_operation.mapper.VisualDesignLogMapper;
import cn.kk.spring_simple_operation.service.VisualDesignLogService;
import cn.kk.spring_simple_operation.utils.DateUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
* <p>
* 视觉操作日志 服务实现类
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Service
public class VisualDesignLogServiceImpl extends ServiceImpl<VisualDesignLogMapper, VisualDesignLog> implements VisualDesignLogService {
@Override
public void addLog(String operationKey, String operationContent, Long relationId) {
if(StringUtils.isEmpty(operationContent)){
return;
}
VisualDesignLog visualDesignLog = new VisualDesignLog();
visualDesignLog.setId(IdWorker.getId());
visualDesignLog.setOperationKey(operationKey);
visualDesignLog.setCreateId(0);
visualDesignLog.setCreateName("系统");
visualDesignLog.setOperationContent(operationContent);
visualDesignLog.setRelationId(relationId);
visualDesignLog.setFileUrl("");
visualDesignLog.setCreateTime(DateUtils.getCurrentTimeSecond());
visualDesignLog.setOperationType("");
this.save(visualDesignLog);
}
}
package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.VisualDesigner;
import cn.kk.spring_simple_operation.mapper.VisualDesignerMapper;
import cn.kk.spring_simple_operation.service.VisualDesignerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 视觉设计人员信息 服务实现类
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Service
public class VisualDesignerServiceImpl extends ServiceImpl<VisualDesignerMapper, VisualDesigner> implements VisualDesignerService {
}
package cn.kk.spring_simple_operation.service.impl;
import cn.kk.spring_simple_operation.entity.VisualDesigner;
import cn.kk.spring_simple_operation.entity.VisualPhotographerAPlus;
import cn.kk.spring_simple_operation.mapper.VisualDesignerMapper;
import cn.kk.spring_simple_operation.mapper.VisualPhotographerAPlusMapper;
import cn.kk.spring_simple_operation.service.VisualDesignLogService;
import cn.kk.spring_simple_operation.service.VisualPhotographerAPlusService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
/**
* <p>
* 视觉设计协同系统-摄影A+ 服务实现类
* </p>
*
* @author guokunkun
* @since 2025-02-19
*/
@Slf4j
@Service
public class VisualPhotographerAPlusServiceImpl extends ServiceImpl<VisualPhotographerAPlusMapper, VisualPhotographerAPlus> implements VisualPhotographerAPlusService {
@Resource
private VisualDesignerMapper visualDesignerMapper;
@Resource
private VisualDesignLogService visualDesignLogService;
@Override
public void brushDataForExecutor() {
AtomicInteger count = new AtomicInteger(0);
List<VisualPhotographerAPlus> list = baseMapper.listNoExecutor();
list.forEach(item -> {
VisualDesigner visualDesigner = visualDesignerMapper.getDesignerByPlan(item.getExecutorNumber());
if (Objects.isNull(visualDesigner)) {
return;
}
item.setExecutorName(visualDesigner.getUserName());
item.setExecutorNumber(visualDesigner.getVisualNumber());
baseMapper.updateById(item);
visualDesignLogService.addLog("visual_photographer_a_plus", "分配执行人为:" + visualDesigner.getUserName(), item.getId());
count.incrementAndGet();
});
log.info("brushDataForExecutor success, count: {}, all: {}", count.get(), list.size());
}
}
<?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="cn.kk.spring_simple_operation.mapper.VisualDesignLogMapper">
</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="cn.kk.spring_simple_operation.mapper.VisualDesignerMapper">
<select id="getDesignerByPlan" resultType="cn.kk.spring_simple_operation.entity.VisualDesigner">
SELECT
visual_number,
user_name
FROM
visual_designer
WHERE
department_key = 'photographer_group'
AND relevance_plan LIKE CONCAT('%', #{planNumber}, '%')
AND is_delete = 0
limit 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="cn.kk.spring_simple_operation.mapper.VisualPhotographerAPlusMapper">
<select id="listNoExecutor" resultType="cn.kk.spring_simple_operation.entity.VisualPhotographerAPlus">
SELECT
vpap.id,
vapp.executor_number
FROM
visual_photographer_a_plus vpap
INNER JOIN visual_a_plus_plan vapp ON vapp.id = vpap.a_plus_plan_id
WHERE
vpap.`status` = 0
AND vpap.is_delete = 0
AND vapp.is_delete = 0
AND vpap.executor_number = ''
AND vapp.`status` = 2
AND vapp.executor_number > ''
AND vapp.executor_number != 'is_delete'
GROUP BY vpap.id
</select>
</mapper>
package cn.kk.spring_simple_operation;
import cn.kk.spring_simple_operation.service.VisualPhotographerAPlusService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
/**
* @author kk
* @date 2025/2/19
*/
@SpringBootTest
public class ApplicationTest {
@Resource
private VisualPhotographerAPlusService visualPhotographerAPlusService;
@Test
void contextLoads() {
visualPhotographerAPlusService.brushDataForExecutor();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment