Commit 8f40f7c2 by Your Name Committed by chenzg

更新部门下不能新增岗位员工

parent e71d6fc1
package cn.timer.api.bean.spmk;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javafx.scene.text.Text;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* @author Tang 2020-04-17
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "spmk_approve_detail_summary")
@ApiModel("新审批详情")
public class SpmkApproveDetailSummary extends Model<SpmkApproveDetailSummary> implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号 编号", example = "101")
private Integer id;
@ApiModelProperty(value = "审批汇总id 审批汇总id", example = "101")
private Integer approveSummaryId;
@ApiModelProperty(value = "标题 ", example = "标题")
private String name;
@ApiModelProperty(value = "所在部门名称 ", example = "所在部门名称")
private String departmentName;
@ApiModelProperty(value = "申请数据 ", example = "申请数据")
private String requestData;
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private String froms;
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private String router;
@ApiModelProperty(value = "通过节点 ", example = "通过节点")
private String flowChildren;
}
\ No newline at end of file
......@@ -221,14 +221,15 @@ public class ClockInController {
//无记录的话就找昨天的数据
AttendanceCardListDto attdate1 = MethodCall(qyid,userid,yesterday);
List<AttSchedule> ashssyebo = attdate1.getAttsch();//获取昨天应打卡时间
if(ashssyebo.size() > 0) {
Date sd1=df1.parse(ClockInTool.stampToDate(String.valueOf(ashssyebo.get(0).getTime())));//当天应打的首次上班卡时间
Date sd2=df1.parse(current_time);//当前时间
if(sd2.after(sd1)) {//大于
dnck = true;
if(ashssyebo!=null) {
if (ashssyebo.size() > 0) {
Date sd1 = df1.parse(ClockInTool.stampToDate(String.valueOf(ashssyebo.get(0).getTime())));//当天应打的首次上班卡时间
Date sd2 = df1.parse(current_time);//当前时间
if (sd2.after(sd1)) {//大于
dnck = true;
}
}
}
// crdk = true;
// attdate = MethodCall(qyid,userid,yesterday);
if(EmptyUtil.isNotEmpty(attdate.getAttsch()) && ashss.get(0).getId() != 0) {//班次不为空
......
......@@ -13,5 +13,8 @@ public interface SpmkService {
SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId);
List<SpmkApprovalG> selectListAg(UserBean userBean);
void addApproveDetail(String status);
}
......@@ -3,6 +3,14 @@ package cn.timer.api.controller.spmk.service;
import java.util.ArrayList;
import java.util.List;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.*;
import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.Router;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -11,22 +19,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ObjectUtil;
import cn.timer.api.bean.spmk.SpmkApprovalG;
import cn.timer.api.bean.spmk.SpmkApprovalTemplate;
import cn.timer.api.bean.spmk.SpmkApprovalTemplateG;
import cn.timer.api.bean.spmk.SpmkApproveDetail;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkCustomApproval;
import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.spmk.SpmkApprovalGMapper;
import cn.timer.api.dao.spmk.SpmkApproveDetailMapper;
import cn.timer.api.dao.spmk.SpmkApproveExecuteRecordMapper;
import cn.timer.api.dao.spmk.SpmkCustomApprovalMapper;
import cn.timer.api.dto.spmk.SpmkApproveDetailDto;
import cn.timer.api.utils.ResultUtil;
@Service
public class SpmkServiceImpl implements SpmkService{
......@@ -35,9 +31,6 @@ public class SpmkServiceImpl implements SpmkService{
private ZzglBmgwMService zzglBmgwMService;
@Autowired
private SpmkCustomApprovalMapper spmkCustomApprovalMapper;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
......@@ -45,7 +38,12 @@ public class SpmkServiceImpl implements SpmkService{
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkApproveDetailSummaryMapper spmkApproveDetailSummaryMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
/**
* 根据orgCode查数据库 审批模板 生成 自定义模板
* orgCode 企业id
......@@ -92,7 +90,8 @@ public class SpmkServiceImpl implements SpmkService{
@Override
public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId) {
// TODO Auto-generated method stub
SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
//SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, asId));
SpmkApproveSummary sum = null;
if(ad != null) {
sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime)
......@@ -105,10 +104,18 @@ public class SpmkServiceImpl implements SpmkService{
}
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(asId);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","spmkApproveExecuteRecord");
adD.setRequestData(ObjectUtil.deserialize(ad.getRequestData()));
adD.setFroms(ObjectUtil.deserialize(ad.getFroms()));
adD.setRouter(ObjectUtil.deserialize(ad.getRouter()));
adD.setFlowChildren(ObjectUtil.deserialize(ad.getFlowChildren()));
if(ad.getRequestData() !=null) {
adD.setRequestData(jsonObject.parseObject(ad.getRequestData(), JSONObject.class));
}
if(ad.getFroms()!=null) {
adD.setFroms(jsonObject.parseArray(ad.getFroms(), JSONObject.class));
}
if(ad.getFlowChildren() !=null) {
adD.setRouter(jsonObject.parseObject(ad.getRouter(), Router.class));
}
if(ad.getFlowChildren()!=null) {
adD.setFlowChildren(jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class));
}
adD.setApproveExecuteRecord(listAer);
if(sum != null) {
adD.setEmpNum(sum.getEmpNum());
......@@ -134,6 +141,7 @@ public class SpmkServiceImpl implements SpmkService{
return adD;
}
@Override
public List<SpmkApprovalG> selectListAg(UserBean userBean) {
// TODO Auto-generated method stub
......@@ -141,4 +149,56 @@ public class SpmkServiceImpl implements SpmkService{
return spmkApprovalGMapper.selectListAgInCa(userBean.getOrgCode(), userBean.getEmpNum(), depts);
}
/**
* 审核汇总详情数据转换
* @param status
*/
@Override
public void addApproveDetail(String status) {
if ("1".equals(status)) {
QueryWrapper queryWrapper = new QueryWrapper<SpmkApproveDetail>().select("id,approve_summary_id", "name", "department_name", "request_data", "froms", "router", "flow_children");
List<SpmkApproveDetail> spmkApproveDetails = spmkApproveDetailMapper.selectList(queryWrapper);
spmkApproveDetails.forEach(t -> {
SpmkApproveDetailSummary spmkApproveDetailSummary = new SpmkApproveDetailSummary();
spmkApproveDetailSummary.setApproveSummaryId(t.getApproveSummaryId());
spmkApproveDetailSummary.setDepartmentName(t.getDepartmentName());
spmkApproveDetailSummary.setName(t.getName());
try {
Object deserialize2 = ObjectUtil.deserialize(t.getFlowChildren());
String flowChidren = JSON.toJSONString(deserialize2);
spmkApproveDetailSummary.setFlowChildren(flowChidren);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize1 = ObjectUtil.deserialize(t.getFroms());
String froms = JSON.toJSONString(deserialize1);
spmkApproveDetailSummary.setFroms(froms);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize = ObjectUtil.deserialize(t.getRequestData());
String s = JSON.toJSONString(deserialize);
spmkApproveDetailSummary.setRequestData(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Router router = ObjectUtil.deserialize(t.getRouter());
String s = JSON.toJSONString(router);
spmkApproveDetailSummary.setRouter(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
spmkApproveDetailSummary.insert();
}
}
}
}
});
}
}
}
package cn.timer.api.dao.spmk;
import cn.timer.api.bean.spmk.SpmkApproveDetailSummary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Service;
@Service
public interface SpmkApproveDetailSummaryMapper extends BaseMapper<SpmkApproveDetailSummary> {
int deleteByPrimaryKey(Integer id);
int insert(SpmkApproveDetailSummary record);
int insertSelective(SpmkApproveDetailSummary record);
SpmkApproveDetailSummary selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SpmkApproveDetailSummary record);
int updateByPrimaryKey(SpmkApproveDetailSummary record);
}
\ No newline at end of file
<?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.timer.api.dao.spmk.SpmkApproveDetailSummaryMapper" >
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="approve_summary_id" property="approveSummaryId" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="department_name" property="departmentName" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ResultMap" type="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" extends="BaseResultMap" >
<result column="request_data" property="requestData" jdbcType="LONGVARCHAR" />
<result column="froms" property="froms" jdbcType="LONGVARCHAR" />
<result column="router" property="router" jdbcType="LONGVARCHAR" />
<result column="flow_children" property="flowChildren" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, approve_summary_id, name, department_name
</sql>
<sql id="Blob_Column_List" >
request_data, froms, router, flow_children
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from spmk_approve_detail_summary
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from spmk_approve_detail_summary
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
insert into spmk_approve_detail_summary (id, approve_summary_id, name,
department_name, request_data, froms,
router, flow_children)
values (#{id,jdbcType=INTEGER}, #{approveSummaryId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{departmentName,jdbcType=VARCHAR}, #{requestData,jdbcType=LONGVARCHAR}, #{froms,jdbcType=LONGVARCHAR},
#{router,jdbcType=LONGVARCHAR}, #{flowChildren,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
insert into spmk_approve_detail_summary
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="approveSummaryId != null" >
approve_summary_id,
</if>
<if test="name != null" >
name,
</if>
<if test="departmentName != null" >
department_name,
</if>
<if test="requestData != null" >
request_data,
</if>
<if test="froms != null" >
froms,
</if>
<if test="router != null" >
router,
</if>
<if test="flowChildren != null" >
flow_children,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="approveSummaryId != null" >
#{approveSummaryId,jdbcType=INTEGER},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="departmentName != null" >
#{departmentName,jdbcType=VARCHAR},
</if>
<if test="requestData != null" >
#{requestData,jdbcType=LONGVARCHAR},
</if>
<if test="froms != null" >
#{froms,jdbcType=LONGVARCHAR},
</if>
<if test="router != null" >
#{router,jdbcType=LONGVARCHAR},
</if>
<if test="flowChildren != null" >
#{flowChildren,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
update spmk_approve_detail_summary
<set >
<if test="approveSummaryId != null" >
approve_summary_id = #{approveSummaryId,jdbcType=INTEGER},
</if>
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="departmentName != null" >
department_name = #{departmentName,jdbcType=VARCHAR},
</if>
<if test="requestData != null" >
request_data = #{requestData,jdbcType=LONGVARCHAR},
</if>
<if test="froms != null" >
froms = #{froms,jdbcType=LONGVARCHAR},
</if>
<if test="router != null" >
router = #{router,jdbcType=LONGVARCHAR},
</if>
<if test="flowChildren != null" >
flow_children = #{flowChildren,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimary" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
update spmk_approve_detail_summary
set approve_summary_id = #{approveSummaryId,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
department_name = #{departmentName,jdbcType=VARCHAR},
request_data = #{requestData,jdbcType=LONGVARCHAR},
froms = #{froms,jdbcType=LONGVARCHAR},
router = #{router,jdbcType=LONGVARCHAR},
flow_children = #{flowChildren,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailSummary" >
update spmk_approve_detail_summary
set approve_summary_id = #{approveSummaryId,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
department_name = #{departmentName,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
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