Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-12-04 10:26:11 +08:00
commit 4a36e9f7b8
24 changed files with 711 additions and 268 deletions

View File

@ -280,7 +280,7 @@ public class DingTalkUtil {
* @param accessToken
* @return
*/
public List<DepartmentStaffBo> getDepartmentStaffDetailsV2(String accessToken, String departmentId) {
public List<DepartmentStaffBo> getDepartmentStaffDetailsV2(String accessToken, String departmentId, Map<String, String> mapProbation) {
try {
long page = 0L;
List<DepartmentStaffBo> list =new ArrayList<>();
@ -324,6 +324,11 @@ public class DingTalkUtil {
departmentStaffBo.setEmail(json.getString("email"));//邮箱钉钉的企业邮箱才可以需要单独授权手机权限
departmentStaffBo.setAvatar(json.getString("avatar"));//头像
departmentStaffBo.setPosition(json.getString("title"));
if(mapProbation.containsKey(departmentStaffBo.getEmployeeId())){
departmentStaffBo.setEmployeeType(2);
}else{
departmentStaffBo.setEmployeeType(1);
}
departmentStaffBo.setStatus(0);
/*if(json.getBoolean("active")){
//在职已激活

View File

@ -342,7 +342,7 @@ public class ResultRecordController extends AbstractController {
@ApiOperation("绩效催办-吴林")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "绩效id")})
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = R.class)})
public R getDetail(@RequestParam Long id) {
public R urging(@RequestParam Long id) {
ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id);
//获取当前节点谁在处理
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordsByRecordIdAndStatus(id, 2);
@ -727,6 +727,19 @@ public class ResultRecordController extends AbstractController {
List<ResultScore> insertScores = new ArrayList<>();
List<ResultScore> updateScores = new ArrayList<>();
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(dto.getId());
Map<Long, ResultDetail> mapDetails =
resultDetails.stream().collect(Collectors.toMap(ResultDetail::getId, Function.identity(), (e, r) -> e));
//获取当前绩效的节点
boolean isSetKeyResult = false;
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordByRecordIdStatus(dto.getId(), 2);
if(flowRecords.size() > 0){
if(flowRecords.get(0).getFlowProcess().intValue() == 0){
//指定目标中
isSetKeyResult = true;
}
}
for (ResultRecortModelDto model:dto.getRecortModelDtos()
) {
@ -739,6 +752,36 @@ public class ResultRecordController extends AbstractController {
) {//排序
ResultDetail resultDetail = new ResultDetail();
BeanUtils.copyProperties(detailDto, resultDetail);
if(!isSetKeyResult && resultDetail.getId() != null && mapDetails.containsKey(resultDetail.getId())){
//这里判断是否有更新或者删除
ResultDetail resultDetail1 = mapDetails.get(resultDetail.getId());
boolean isUp = false;
if(!resultDetail.getTarget().equals(resultDetail1.getTarget())){
//打上标识
isUp = true;
}
if(!resultDetail.getCheckResult().equals(resultDetail1.getCheckResult())){
//打上标识
isUp = true;
resultDetail1.setCheckResult("<s>" + resultDetail1.getCheckResult() + "</s>");
}
if(!resultDetail.getCheckWeight().equals(resultDetail1.getCheckWeight())){
//打上标识
isUp = true;
//resultDetail1.setTarget("<s>" + resultDetail1.getTarget() + "</s>");
}
if(isUp){
resultDetail1.setId(null);
resultDetail1.setIsBack(1);
resultDetail1.setTarget("<s>" + resultDetail1.getTarget() + "</s>");
resultDetail1.setBackId(resultDetail.getId());
inserts.add(resultDetail);
}
}
resultDetail.setPriority(index);
index++;
@ -1139,6 +1182,8 @@ public class ResultRecordController extends AbstractController {
// 审批http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=215&status=1&comment=xxx&menuName=bbb
// 跳过http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=215&status=4&menuName=bbb&flowRecordId=360
// 转交http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=215&status=8&menuName=bbb&flowRecordId=360&transferStaffId=294
// 重置http://localhost:8080/lz_management/user/lzresultrecord/new/approval?resultRecordId=3702&status=9&menuName=cccc&flowRecordId=33987&resetFlag=0
@RequestMapping("/new/approval")
public R approval(ApprovalDto approvalDto) {
try {
@ -1152,7 +1197,6 @@ public class ResultRecordController extends AbstractController {
}
/**
*
* 删除
*/
// http://localhost:8080/lz_management/user/lzresultrecord/new/resultRecordDetail?resultRecordId=593&loginUserId=322
@ -1166,4 +1210,16 @@ public class ResultRecordController extends AbstractController {
}
// http://localhost:8080/lz_management/user/lzresultrecord/get/reset/data?resultRecordId=593&loginUserId=322
@RequestMapping("/get/reset/data")
public R getResetData(RecordDetailDto recordDetailDto) {
if(recordDetailDto.getLoginUserId() ==null && getUser() !=null ){
recordDetailDto.setLoginUserId(getUserId());
}
return resultRecordService.getResetData(recordDetailDto);
}
}

View File

@ -9,6 +9,7 @@ import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dto.ApprovalDto;
import com.lz.modules.app.dto.RecordDetailDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
@ -298,4 +299,20 @@ public class TestController {
System.out.println(roleIds);
}
//http://localhost:8080/lz_management/test/reset/data?resultRecordId=3682
@RequestMapping("/test/reset/data")
public R getResetData(RecordDetailDto recordDetailDto) {
return resultRecordService.getResetData(recordDetailDto);
}
// 重置http://localhost:8080/lz_management/test/approval?resultRecordId=3682&status=9&menuName=cccc&flowRecordId=33919&resetFlag=0
@RequestMapping("/test/approval")
public R approval(ApprovalDto approvalDto) {
try {
return resultRecordService.newApproval(approvalDto);
} catch (Exception e) {
return R.error(e.getMessage());
}
}
}

View File

@ -11,4 +11,6 @@ public class ApprovalDto {
private String comment;
private Long transferStaffId; // 转交员工 id
private Long flowRecordId;// 流程 id
private int resetFlag;
private int clearFlag;//0 全清1 还是保留指标
}

View File

@ -0,0 +1,13 @@
package com.lz.modules.app.resp;
import lombok.Data;
import java.util.List;
@Data
public class ResetDataResp {
private String flowName;
private List<String> staffNames;
private Long id ;
}

View File

@ -93,4 +93,16 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex, @Param("status") int status);
List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(@Param("recordId") Long recordId, @Param("status") int status);
List<FlowRecord> selectFlowRecordByRecordIdGeFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") Integer flowIndex);
List<FlowRecord> selectFlowRecordByRecordIdLeFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") Integer flowIndex);
void deleteFlowRecordByRecordId(@Param("recordId") Long recordId);
void updateFlowRecordIdById(@Param("id") Long id, @Param("newId") Long newId);
FlowRecord selectPreFlowRecordByRecordIdMinIdStatusList(@Param("recordId") Long recordId, @Param("flowIndex") Integer flowIndex, @Param("statusList") List<Integer> statusList);
List<FlowRecord> selectFlowRecordByRecordIdFlowIndexStatusList(@Param("recordId") Long recordId, @Param("flowIndex") Integer flowIndex, @Param("statusList") List<Integer> statusList);
}

View File

@ -37,4 +37,6 @@ public interface ResultScoreMapper extends BaseMapper<ResultScore> {
List<ResultScore> selectResultScoresByDetailId(@Param("id") Long id);
List<ResultScore> selectResultScoresByDetailIdAndOrderByStaffIds(@Param("id") Long id, @Param("list") List<ResultScoreDto> scoreDtos);
int deleteResultScoreByDetailId(Long id);
}

View File

@ -12,7 +12,7 @@ import java.util.Date;
* <p>
* </p>*业绩详情评分表
* @author quyixiao
* @since 2020-11-12
* @since 2020-12-03
*/
@Data
@ -46,6 +46,9 @@ public class ResultScore implements java.io.Serializable {
//评分权重
@ApiModelProperty(value = "评分权重", name = "weight")
private BigDecimal weight;
//根据权重计算除的实际得分
@ApiModelProperty(value = "根据权重计算除的实际得分", name = "score")
private BigDecimal score;
/**
*
* @return
@ -181,6 +184,21 @@ public class ResultScore implements java.io.Serializable {
this.weight = weight;
}
/**
* 根据权重计算除的实际得分
* @return
*/
public BigDecimal getScore() {
return score;
}
/**
* 根据权重计算除的实际得分
* @param score
*/
public void setScore(BigDecimal score) {
this.score = score;
}
@Override
public String toString() {
return "ResultScore{" +
@ -193,6 +211,7 @@ public class ResultScore implements java.io.Serializable {
",approvalId=" + approvalId +
",scoreComment=" + scoreComment +
",weight=" + weight +
",score=" + score +
"}";
}
}

View File

@ -43,6 +43,10 @@ public class ResultScoreDto {
//评分说明
@ApiModelProperty(value = "评分说明", name = "scoreComment")
private String scoreComment;
//根据权重计算除的实际得分
@ApiModelProperty(value = "根据权重计算除的实际得分", name = "score")
private BigDecimal score;
/**
*
* @return

View File

@ -6,6 +6,7 @@ import com.lz.modules.equipment.entity.model.BasePage;
import com.lz.modules.flow.entity.FlowRecord;
import com.lz.modules.performance.req.AssessTaskReq;
import com.lz.modules.sys.entity.app.ResultRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -88,4 +89,16 @@ public interface FlowRecordService extends IService<FlowRecord> {
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(Long recordId, int status);
List<FlowRecord> selectFlowRecordByRecordIdGeFlowIndex(Long recordId, Integer flowIndex);
void deleteFlowRecordByRecordId(Long recordId);
void updateFlowRecordIdById(Long id, Long newId);
FlowRecord selectPreFlowRecordByRecordIdMinIdStatusList(Long recordId, Integer flowIndex, List<Integer> statusList);
List<FlowRecord> selectFlowRecordByRecordIdFlowIndexStatusList(Long recordId, Integer flowIndex, List<Integer> statusList);
List<FlowRecord> selectFlowRecordByRecordIdLeFlowIndex(Long resultRecordId, Integer flowIndex);
}

View File

@ -36,4 +36,6 @@ public interface ResultScoreService extends IService<ResultScore> {
List<ResultScore> selectResultScoresByDetailId(Long id);
List<ResultScore> selectResultScoresByDetailIdAndOrderByStaffIds(Long id, List<ResultScoreDto> scoreDtos);
int deleteResultScoreByDetailId(Long id);
}

View File

@ -236,4 +236,34 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectFlowRecordsByRecordIdAndStatus(recordId, status);
}
@Override
public List<FlowRecord> selectFlowRecordByRecordIdGeFlowIndex(Long recordId, Integer flowIndex) {
return flowRecordMapper.selectFlowRecordByRecordIdGeFlowIndex(recordId,flowIndex);
}
@Override
public void deleteFlowRecordByRecordId(Long recordId) {
flowRecordMapper.deleteFlowRecordByRecordId(recordId);
}
@Override
public void updateFlowRecordIdById(Long id, Long newId) {
flowRecordMapper.updateFlowRecordIdById(id,newId);
}
@Override
public FlowRecord selectPreFlowRecordByRecordIdMinIdStatusList(Long recordId, Integer flowIndex, List<Integer> statusList) {
return flowRecordMapper.selectPreFlowRecordByRecordIdMinIdStatusList(recordId,flowIndex,statusList);
}
@Override
public List<FlowRecord> selectFlowRecordByRecordIdFlowIndexStatusList(Long recordId, Integer flowIndex, List<Integer> statusList) {
return flowRecordMapper.selectFlowRecordByRecordIdFlowIndexStatusList(recordId,flowIndex,statusList);
}
@Override
public List<FlowRecord> selectFlowRecordByRecordIdLeFlowIndex(Long resultRecordId, Integer flowIndex) {
return flowRecordMapper.selectFlowRecordByRecordIdLeFlowIndex(resultRecordId,flowIndex);
}
}

View File

@ -71,6 +71,11 @@ public class ResultScoreServiceImpl extends ServiceImpl<ResultScoreMapper, Resul
return resultScoreMapper.selectResultScoresByDetailIdAndOrderByStaffIds(id, scoreDtos);
}
@Override
public int deleteResultScoreByDetailId(Long id){
return resultScoreMapper.deleteResultScoreByDetailId(id);
}
}

View File

@ -6,8 +6,10 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRoleListRequest;
import com.dingtalk.api.request.OapiRoleSimplelistRequest;
import com.dingtalk.api.request.OapiSmartworkHrmEmployeeQueryonjobRequest;
import com.dingtalk.api.response.OapiRoleListResponse;
import com.dingtalk.api.response.OapiRoleSimplelistResponse;
import com.dingtalk.api.response.OapiSmartworkHrmEmployeeQueryonjobResponse;
import com.google.common.collect.Lists;
import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.utils.DateUtils;
@ -44,13 +46,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -195,6 +195,9 @@ public class DingtalkBusiness {
List<DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetailsV2(token, "1");
if(departmentInfosBos.size() > 0){
List<String> probationUserIDS = getProbationStaff(token);//获取试用期人员信息
Map<String, String> mapProbation =
probationUserIDS.stream().collect(Collectors.toMap(String::toString, Function.identity(), (e, r) -> e));
//获取原有部门信息
Map<String, DepartmentInfosBo> mapDepartmentInfosBos
= departmentInfosBos.stream().collect(Collectors.toMap(DepartmentInfosBo::getId, Function.identity(), (e, r) -> e));
@ -251,7 +254,7 @@ public class DingtalkBusiness {
}
//获取部门用户详情
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetailsV2(token, departmentInfo.getId());
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetailsV2(token, departmentInfo.getId(), mapProbation);
logger.info("=============================" + departmentInfo.getName() + "================================");
//设置本部门人数
if(departmentInfo.getMemberCount() == null){
@ -466,6 +469,7 @@ public class DingtalkBusiness {
if(addStaffs.size() > 0){//有新增部门
logger.info("新增人员信息个数{}", addStaffs.size());
staffService.saveBatch(addStaffs);
String key;
for (StaffEntity entity:addStaffs
@ -495,6 +499,8 @@ public class DingtalkBusiness {
}
}
if(updateStaffs.size() > 0){//有新增部门
logger.info("更新人员信息个数{}", updateStaffs.size());
staffService.updateBatchById(updateStaffs);
@ -559,6 +565,41 @@ public class DingtalkBusiness {
}
}
private List<String> getProbationStaff(String token){
//获取试用期员工信息
try {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest();
Long offSet = 0L;
req.setStatusList("2");
req.setSize(50L);
boolean isNext = false;
List<String> ids = new ArrayList<>();
{
req.setOffset(offSet);
OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.execute(req, token);
logger.info("钉钉请求试用期员工返回信息{}", rsp.getBody());
JSONObject jsonObject = JSONObject.parseObject(rsp.getBody());
if(jsonObject.getIntValue("errcode") == 0){
jsonObject = jsonObject.getJSONObject("result");
offSet = jsonObject.getLong("next_cursor");
if(offSet != null){
isNext = true;
}
JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("data_list"));
ids.addAll(Arrays.stream(jsonArray.toArray(new String[jsonArray.size()])).collect(Collectors.toList()));
}else{
logger.info("钉钉请求返回错误{}", jsonObject);
}
}while(isNext)
return ids;
} catch (ApiException e) {
e.printStackTrace();
}
return null;
}
public void enterStaffOccupationInfos(List<DepartmentStaffBo> staffs) {
@ -586,6 +627,24 @@ public class DingtalkBusiness {
}
}
public String urging(Long recordId) {
ResultRecord lzResultRecord = resultRecordService.selectResultRecordById(recordId);
//获取当前节点谁在处理
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordsByRecordIdAndStatus(recordId, 2);
if(flowRecords.size() > 0){
List<Long> ids = flowRecords.stream().map(new Function<FlowRecord, Long>() {
@Override
public Long apply(FlowRecord flowRecord) {
return flowRecord.getApprovalStaffId();
}
}).collect(Collectors.toList());
List<StaffEntity> staffs = staffService.selectNamesByIds(ids);
sendNoticeMsg(lzResultRecord, staffs);
return "OK";
}
return "error";
}
public String sendNoticeMsg(ResultRecord lzResultRecord, List<StaffEntity> staffs) {
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);

View File

@ -46,4 +46,6 @@ public interface ResultDetailMapper extends BaseMapper<ResultDetail> {
Long insertResultDetails(@Param("list") List<ResultDetail> resultDetails);
List<ResultDetailDto> selectDtosByRecordId(@Param("recordResultId") Long id, @Param("modelId") Long modelId);
int deleteResultDetailByRecordId(@Param("recordId") Long recordId);
}

View File

@ -12,7 +12,7 @@ import java.util.Date;
* <p>
* </p>*业绩详情表
* @author quyixiao
* @since 2020-11-17
* @since 2020-12-03
*/
@Data
@ -31,6 +31,12 @@ public class ResultDetail implements java.io.Serializable {
//最后修改时间
@ApiModelProperty(value = "最后修改时间", name = "gmtModified")
private Date gmtModified;
//备份id本表得id
@ApiModelProperty(value = "备份id本表得id", name = "backId")
private Long backId;
//是否为备份0非备份1备份值
@ApiModelProperty(value = "是否为备份0非备份1备份值", name = "isBack")
private Integer isBack;
//1业绩2文化价值观
@ApiModelProperty(value = "1业绩2文化价值观", name = "type")
private Integer type;
@ -133,6 +139,36 @@ public class ResultDetail implements java.io.Serializable {
this.gmtModified = gmtModified;
}
/**
* 备份id本表得id
* @return
*/
public Long getBackId() {
return backId;
}
/**
* 备份id本表得id
* @param backId
*/
public void setBackId(Long backId) {
this.backId = backId;
}
/**
* 是否为备份0非备份1备份值
* @return
*/
public Integer getIsBack() {
return isBack;
}
/**
* 是否为备份0非备份1备份值
* @param isBack
*/
public void setIsBack(Integer isBack) {
this.isBack = isBack;
}
/**
* 1业绩2文化价值观
* @return
@ -350,6 +386,8 @@ public class ResultDetail implements java.io.Serializable {
",isDelete=" + isDelete +
",gmtCreate=" + gmtCreate +
",gmtModified=" + gmtModified +
",backId=" + backId +
",isBack=" + isBack +
",type=" + type +
",target=" + target +
",keyResult=" + keyResult +

View File

@ -70,4 +70,6 @@ public interface ResultDetailService extends IService<ResultDetail> {
Long insertResultDetails(List<ResultDetail> resultDetails);
List<ResultDetailDto> selectDtosByRecordId(Long id, Long modelId);
int deleteResultDetailByRecordId(Long recordId);
}

View File

@ -125,4 +125,10 @@ public interface ResultRecordService extends IService<ResultRecord> {
List<ResultRecord> selectResultRecordsByStartId(Long startId);
List<Long> selectResultRecordIdsByStartId(Long startId);
R getResetData(RecordDetailDto recordDetailDto);
R resetData(Long recordId, int clearFlag);
}

View File

@ -340,4 +340,9 @@ public class ResultDetailServiceImpl extends ServiceImpl<ResultDetailMapper, Res
return resultDetailMapper.selectDtosByRecordId(id, modelId);
}
@Override
public int deleteResultDetailByRecordId(Long recordId){
return resultDetailMapper.deleteResultDetailByRecordId(recordId);
}
}

View File

@ -8,6 +8,8 @@
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="back_id" property="backId"/>
<result column="is_back" property="isBack"/>
<result column="type" property="type"/>
<result column="target" property="target"/>
<result column="key_result" property="keyResult"/>
@ -27,7 +29,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, type AS type, target AS target, key_result AS keyResult, key_result_3_5 AS keyResult35, key_result_3_7 AS keyResult37, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority, model_id AS modelId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, back_id AS backId, is_back AS isBack, type AS type, target AS target, key_result AS keyResult, key_result_3_5 AS keyResult35, key_result_3_7 AS keyResult37, check_weight AS checkWeight, check_result AS checkResult, super_score AS superScore, acquire_score AS acquireScore, score_comment AS scoreComment, record_id AS recordId, staff_id AS staffId, priority AS priority, model_id AS modelId
</sql>
@ -40,6 +42,8 @@
<insert id="insertResultDetail" parameterType="ResultDetail" useGeneratedKeys="true" keyProperty="id" >
insert into lz_result_detail(
<if test="backId != null">back_id, </if>
<if test="isBack != null">is_back, </if>
<if test="type != null">type, </if>
<if test="target != null">target, </if>
<if test="keyResult != null">key_result, </if>
@ -58,6 +62,8 @@
gmt_create,
gmt_modified
)values(
<if test="backId != null">#{ backId}, </if>
<if test="isBack != null">#{ isBack}, </if>
<if test="type != null">#{ type}, </if>
<if test="target != null">#{ target}, </if>
<if test="keyResult != null">#{ keyResult}, </if>
@ -85,6 +91,8 @@
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="backId != null">back_id = #{backId},</if>
<if test="isBack != null">is_back = #{isBack},</if>
<if test="type != null">type = #{type},</if>
<if test="target != null">target = #{target},</if>
<if test="keyResult != null">key_result = #{keyResult},</if>
@ -111,6 +119,8 @@
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
back_id = #{backId},
is_back = #{isBack},
type = #{type},
target = #{target},
key_result = #{keyResult},
@ -125,7 +135,7 @@
staff_id = #{staffId},
priority = #{priority},
model_id = #{modelId}
,gmt_modified = now()
,gmt_modified = now()
where id = #{id}
</update>
@ -189,5 +199,9 @@
select * from lz_result_detail where record_id=#{recordResultId} and model_id = #{modelId} and is_delete = 0 order by priority asc
</select>
<update id="deleteResultDetailByRecordId" parameterType="java.lang.Long">
update lz_result_detail set is_delete = 1, gmt_modified = now() where record_id=#{recordId} and is_delete = 0
</update>
</mapper>

View File

@ -32,7 +32,6 @@
<select id="selectFlowRecordById" resultType="FlowRecord" >
select * from lz_flow_record where id=#{id} and is_delete = 0 limit 1
</select>
@ -324,8 +323,45 @@
</select>
<select id="selectFlowRecordsByRecordIdAndStatus" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0
and record_id = #{recordId} and status=#{status} order by flow_index asc
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status=#{status} order by flow_index asc
</select>
<select id="selectFlowRecordByRecordIdGeFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and flow_index >= #{flowIndex}
</select>
<select id="selectFlowRecordByRecordIdLeFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and flow_index <![CDATA[<=]]> #{flowIndex}
</select>
<select id="selectPreFlowRecordByRecordIdMinIdStatusList" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[<=]]> #{flowIndex}
and record_id = #{recordId}
and status in
<foreach item="item" collection="statusList" open="(" separator="," close=")">
#{item}
</foreach>
order by flow_index desc limit 1
</select>
<select id="selectFlowRecordByRecordIdFlowIndexStatusList" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and flow_index = #{flowIndex}
and record_id = #{recordId}
and status in
<foreach item="item" collection="statusList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteFlowRecordByRecordId">
delete from lz_flow_record where record_id = #{recordId}
</delete>
<update id="updateFlowRecordIdById">
update lz_flow_record set id = #{newId} where id = #{id}
</update>
</mapper>

View File

@ -13,12 +13,13 @@
<result column="approval_id" property="approvalId"/>
<result column="score_comment" property="scoreComment"/>
<result column="weight" property="weight"/>
<result column="score" property="score"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, acquire_score AS acquireScore, detail_id AS detailId, approval_id AS approvalId, score_comment AS scoreComment, weight AS weight
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, acquire_score AS acquireScore, detail_id AS detailId, approval_id AS approvalId, score_comment AS scoreComment, weight AS weight, score AS score
</sql>
@ -36,6 +37,7 @@
<if test="approvalId != null">approval_id, </if>
<if test="scoreComment != null">score_comment, </if>
<if test="weight != null">weight, </if>
<if test="score != null">score, </if>
is_delete,
gmt_create,
gmt_modified
@ -45,6 +47,7 @@
<if test="approvalId != null">#{ approvalId}, </if>
<if test="scoreComment != null">#{ scoreComment}, </if>
<if test="weight != null">#{ weight}, </if>
<if test="score != null">#{ score}, </if>
0,
now(),
now()
@ -62,7 +65,8 @@
<if test="detailId != null">detail_id = #{detailId},</if>
<if test="approvalId != null">approval_id = #{approvalId},</if>
<if test="scoreComment != null">score_comment = #{scoreComment},</if>
<if test="weight != null">weight = #{weight}</if>
<if test="weight != null">weight = #{weight},</if>
<if test="score != null">score = #{score}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -79,14 +83,15 @@
detail_id = #{detailId},
approval_id = #{approvalId},
score_comment = #{scoreComment},
weight = #{weight}
,gmt_modified = now()
weight = #{weight},
score = #{score}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteResultScoreById" parameterType="java.lang.Long">
update lz_result_score set is_delete = 1 where id=#{id} limit 1
update lz_result_score set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectResultScoresByDetailId" resultType="ResultScore" >
@ -101,5 +106,9 @@
)
</select>
<update id="deleteResultScoreByDetailId" parameterType="java.lang.Long">
update lz_result_score set is_delete = 1, gmt_modified = now() where detail_id=#{id} and is_delete = 0
</update>
</mapper>

View File

@ -1,5 +1,7 @@
package com.lz.mysql;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lz.common.utils.StringUtil;
import com.lz.modules.flow.entity.FlowChartRole;
import org.springframework.util.ResourceUtils;
@ -65,51 +67,7 @@ public class MysqlMain {
*/
public static void main(String[] args) throws Exception {
/*Long a = 2l;
Long b = 3l;
String value = "aaa";
StopWatch stopWatch = new StopWatch();
stopWatch.start("测试静态方法");
for(int i = 0; i < 10000; i++){
if(TestStaticAndHuo.isEmpt(value)){
}
}
stopWatch.stop();
stopWatch.start("测试对象方法");
for(int i = 0; i < 10000; i++){
if(value == null || value.length() == 0){
}
}
stopWatch.stop();
System.out.println(stopWatch.prettyPrint());*/
/*List<TestMap> testMaps = new ArrayList<>();
TestMap test = new TestMap();
test.setName("123");
test.setMobile("18969093321");
testMaps.add(test);
test = new TestMap();
test.setName("123");
test.setMobile("18969093321");
testMaps.add(test);
Map<String, TestMap> t = testMaps.stream().collect(Collectors.toMap(TestMap::getName, testMap -> testMap));
List<Long> flowChartRoles = new ArrayList<>();
flowChartRoles.add(1L);
flowChartRoles.add(2L);
flowChartRoles.add(3L);
flowChartRoles.add(4L);
String roles = flowChartRoles.stream().map(new Function<Long, String>() {
@Override
public String apply(Long flowChartRole) {
return flowChartRole.toString();
}
}).collect(Collectors.joining(","));*/
String path = ResourceUtils.getURL("classpath:").getPath();
System.out.println(path);
@ -126,7 +84,8 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("third_msg_send_record"));
list.add(new TablesBean("lz_result_score"));
list.add(new TablesBean("lz_result_detail"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();