Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ba61838d2c
|
|
@ -3,6 +3,7 @@ package com.bonus.sgzb.base.api.domain;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
|
@ -38,6 +39,18 @@ public class LeaseApplyDetails implements Serializable {
|
|||
@ApiModelProperty(value = "规格ID")
|
||||
private Integer typeId;
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
/**
|
||||
* 预领料数
|
||||
*/
|
||||
|
|
@ -70,6 +83,7 @@ public class LeaseApplyDetails implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -82,6 +96,7 @@ public class LeaseApplyDetails implements Serializable {
|
|||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.sgzb.base.api.domain;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
|
@ -119,6 +120,7 @@ public class LeaseApplyInfo implements Serializable {
|
|||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -131,6 +133,7 @@ public class LeaseApplyInfo implements Serializable {
|
|||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.sgzb.base.api.domain;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
|
@ -41,6 +42,12 @@ public class TmTask implements Serializable {
|
|||
@ApiModelProperty(value="任务状态(数据字典)")
|
||||
private Integer taskStatus;
|
||||
|
||||
/**
|
||||
* 预领料合计数
|
||||
*/
|
||||
@ApiModelProperty(value="预领料合计数")
|
||||
private int preCountNum;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
|
|
@ -53,10 +60,29 @@ public class TmTask implements Serializable {
|
|||
@ApiModelProperty(value="创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 申请人手机号码
|
||||
*/
|
||||
@ApiModelProperty(value="手机号")
|
||||
private String phoneNumber;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
@ApiModelProperty(value="部门名称")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@ApiModelProperty(value="工程名称")
|
||||
private String proName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value="创建时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
|
|
@ -69,6 +95,7 @@ public class TmTask implements Serializable {
|
|||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value="更新时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
|
|
@ -101,6 +128,7 @@ public class TmTask implements Serializable {
|
|||
@ApiModelProperty(value="领料任务详情集合")
|
||||
private List<LeaseApplyDetails> leaseApplyDetails;
|
||||
|
||||
|
||||
private Integer agreementId;
|
||||
private Integer backPerson;
|
||||
private String phone;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,5 @@
|
|||
package com.bonus.sgzb.common.security.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.bonus.sgzb.common.core.constant.CacheConstants;
|
||||
import com.bonus.sgzb.common.core.constant.SecurityConstants;
|
||||
import com.bonus.sgzb.common.core.utils.JwtUtils;
|
||||
|
|
@ -18,7 +8,17 @@ import com.bonus.sgzb.common.core.utils.StringUtils;
|
|||
import com.bonus.sgzb.common.core.utils.ip.IpUtils;
|
||||
import com.bonus.sgzb.common.core.utils.uuid.IdUtils;
|
||||
import com.bonus.sgzb.common.redis.service.RedisService;
|
||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||
import com.bonus.sgzb.system.api.model.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* token验证处理
|
||||
|
|
@ -67,6 +67,9 @@ public class TokenService
|
|||
Map<String, Object> rspMap = new HashMap<String, Object>();
|
||||
rspMap.put("access_token", JwtUtils.createToken(claimsMap));
|
||||
rspMap.put("expires_in", expireTime);
|
||||
//密码置空后返回
|
||||
loginUser.getSysUser().setPassword("");
|
||||
rspMap.put("login_user", loginUser);
|
||||
return rspMap;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,10 +63,15 @@ public class TmTaskController extends BaseController {
|
|||
return AjaxResult.error("参数错误");
|
||||
}
|
||||
try {
|
||||
String code = tmTaskService.genderLeaseCode();
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
return AjaxResult.error("后台生成CODE编号异常,请重试!");
|
||||
}
|
||||
task.setCode(code);
|
||||
// 创建任务
|
||||
boolean addTaskResult = tmTaskService.insertSelective(task) > 0;
|
||||
if (addTaskResult && task.getLeaseApplyInfo() != null) {
|
||||
if (CollUtil.isNotEmpty(task.getLeaseApplyDetails())) {
|
||||
if (CollUtil.isEmpty(task.getLeaseApplyDetails())) {
|
||||
return AjaxResult.error("领料设备明细为空,请重新选择后上传!");
|
||||
}
|
||||
if (StringUtils.isNull(task.getLeaseApplyInfo())) {
|
||||
|
|
@ -76,7 +81,7 @@ public class TmTaskController extends BaseController {
|
|||
// 获取任务编号
|
||||
String taskId = task.getId();
|
||||
// 根据设备所属分公司拆分集合
|
||||
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.group(task.getLeaseApplyDetails(), LeaseApplyDetails::getCompanyId);
|
||||
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId");
|
||||
|
||||
// 对拆分后的集合进行遍历
|
||||
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
|
||||
|
|
@ -84,7 +89,7 @@ public class TmTaskController extends BaseController {
|
|||
if (CollUtil.isNotEmpty(leaseApplyDetailsList)) {
|
||||
// 对领料任务表的对象做数据处理
|
||||
LeaseApplyInfo leaseApplyInfo = task.getLeaseApplyInfo();
|
||||
leaseApplyInfo.setCode(tmTaskService.genderLeaseCode()); // 创建领料单号
|
||||
leaseApplyInfo.setCode(code); // 创建领料单号
|
||||
leaseApplyInfo.setTaskId(Integer.valueOf(taskId)); // 设置任务ID
|
||||
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
|
||||
leaseApplyInfo.setType("2"); // 设置审批层级,先固定2层,后期根据接口传入Type区分来源设定
|
||||
|
|
@ -96,6 +101,9 @@ public class TmTaskController extends BaseController {
|
|||
// 领料任务编号
|
||||
Integer leaseTaskId = leaseApplyInfo.getId();
|
||||
if (StringUtils.isNotNull(leaseTaskId)) {
|
||||
for (LeaseApplyDetails leaseApplyDetails : leaseApplyDetailsList) {
|
||||
leaseApplyDetails.setParenntId(leaseTaskId); // 设置领料任务ID
|
||||
}
|
||||
// 插入领料任务明细
|
||||
boolean addLeaseTaskDetailsResult = leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0;
|
||||
if (addLeaseTaskDetailsResult) {
|
||||
|
|
@ -103,6 +111,8 @@ public class TmTaskController extends BaseController {
|
|||
} else {
|
||||
System.out.println("领料任务创建成功,但领料任务明细插入失败");
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("领料任务编号为空");
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("创建领料任务失败,或领料明细为空");
|
||||
|
|
@ -115,7 +125,7 @@ public class TmTaskController extends BaseController {
|
|||
}
|
||||
return AjaxResult.success("任务创建成功,已完成");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("创建任务失败," + e.getMessage());
|
||||
return AjaxResult.error("创建任务失败," + e.getCause().toString() + "," + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,6 +142,8 @@ public class TmTaskController extends BaseController {
|
|||
return AjaxResult.error("参数错误");
|
||||
}
|
||||
try {
|
||||
String code = tmTaskService.genderLeaseCode();
|
||||
task.setCode(code);
|
||||
// 创建任务
|
||||
boolean addTaskResult = tmTaskService.insertSelective(task) > 0;
|
||||
if (addTaskResult && task.getLeaseApplyInfo() != null) {
|
||||
|
|
@ -145,7 +157,8 @@ public class TmTaskController extends BaseController {
|
|||
// 获取任务编号
|
||||
String taskId = task.getId();
|
||||
// 根据设备所属分公司拆分集合
|
||||
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.group(task.getLeaseApplyDetails(), LeaseApplyDetails::getCompanyId);
|
||||
// List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.group(task.getLeaseApplyDetails(), LeaseApplyDetails::getCompanyId);
|
||||
List<List<LeaseApplyDetails>> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId");
|
||||
|
||||
// 对拆分后的集合进行遍历
|
||||
for (List<LeaseApplyDetails> leaseApplyDetailsList : deviceByCompanyList) {
|
||||
|
|
@ -153,7 +166,7 @@ public class TmTaskController extends BaseController {
|
|||
if (CollUtil.isNotEmpty(leaseApplyDetailsList)) {
|
||||
// 对领料任务表的对象做数据处理
|
||||
LeaseApplyInfo leaseApplyInfo = task.getLeaseApplyInfo();
|
||||
leaseApplyInfo.setCode(tmTaskService.genderLeaseCode()); // 创建领料单号
|
||||
leaseApplyInfo.setCode(code); // 创建领料单号
|
||||
leaseApplyInfo.setTaskId(Integer.valueOf(taskId)); // 设置任务ID
|
||||
leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); // 设置设备所属分公司,用于交给哪家审核
|
||||
leaseApplyInfo.setType("1"); // 设置审批层级,先固定2层,后期根据接口传入Type区分来源设定
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@ package com.bonus.sgzb.app.mapper;
|
|||
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
|
||||
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
|
||||
import com.bonus.sgzb.base.api.domain.TmTask;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -26,7 +24,7 @@ public interface TmTaskMapper {
|
|||
* @param record 筛选条件
|
||||
* @return TmTask列表
|
||||
*/
|
||||
List<TmTask> getAuditListByLeaseTmTask(TmTask record);
|
||||
List<TmTask> getAuditListByLeaseTmTask(@Param("record") TmTask record);
|
||||
|
||||
List<LeaseApplyInfo> getAuditListByLeaseInfo(@Param("record") TmTask record);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,13 @@ import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
|
|||
import com.bonus.sgzb.base.api.domain.TmTask;
|
||||
import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* @Author 阮世耀
|
||||
|
|
@ -34,6 +35,7 @@ public class TmTaskServiceImpl implements TmTaskService{
|
|||
public List<TmTask> getLeaseAuditList(TmTask record) {
|
||||
List<TmTask> tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
|
||||
for (TmTask tmTask : tmTaskList) {
|
||||
int count = 0;
|
||||
if (tmTask != null) {
|
||||
// 去查询任务分单表
|
||||
List<LeaseApplyInfo> auditListByLeaseInfo = tmTaskMapper.getAuditListByLeaseInfo(tmTask);
|
||||
|
|
@ -44,6 +46,12 @@ public class TmTaskServiceImpl implements TmTaskService{
|
|||
// 去查询领料任务详情表
|
||||
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetails(leaseApplyInfo);
|
||||
if (leaseApplyDetails != null && !leaseApplyDetails.isEmpty()) {
|
||||
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
|
||||
if (leaseApplyDetail != null) {
|
||||
// 统计预领数量
|
||||
count += leaseApplyDetail.getPreNum();
|
||||
}
|
||||
}
|
||||
// 塞入领料任务详情集合
|
||||
leaseApplyInfo.setLeaseApplyDetails(leaseApplyDetails);
|
||||
}
|
||||
|
|
@ -52,6 +60,8 @@ public class TmTaskServiceImpl implements TmTaskService{
|
|||
// 存入领料任务实体集合
|
||||
tmTask.setLeaseApplyInfoList(auditListByLeaseInfo);
|
||||
}
|
||||
// 塞入预领的合计数量
|
||||
tmTask.setPreCountNum(count);
|
||||
}
|
||||
}
|
||||
return tmTaskList;
|
||||
|
|
@ -92,10 +102,11 @@ public class TmTaskServiceImpl implements TmTaskService{
|
|||
|
||||
@Override
|
||||
public String genderLeaseCode() {
|
||||
//String code = "0001";
|
||||
Random random = new Random();
|
||||
// 先生成随机4位字符,后期根据数据库当月最大CODE值+1
|
||||
String code = RandomStringUtils.randomAlphanumeric(4);
|
||||
return "L" + DateUtils.getDate() + "-" + code;
|
||||
int number = random.nextInt(9999);
|
||||
// 将随机整激格式化4位字符串,不足4位在前面补
|
||||
return "L" + DateUtils.getDate() + "-" + String.format("%04d", number);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSelective" keyColumn="task_id" keyProperty="taskId" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
|
||||
<insert id="insertSelective" keyColumn="task_id" keyProperty="id" parameterType="com.bonus.sgzb.base.api.domain.TmTask" useGeneratedKeys="true">
|
||||
insert into tm_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskType != null">
|
||||
|
|
@ -57,9 +57,7 @@
|
|||
<if test="createBy != null and createBy != ''">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by,
|
||||
</if>
|
||||
|
|
@ -86,9 +84,7 @@
|
|||
<if test="createBy != null and createBy != ''">
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
now(),
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
|
@ -451,7 +447,20 @@
|
|||
</insert>
|
||||
|
||||
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
|
||||
SELECT tt.* FROM tm_task tt WHERE tt.task_type = '29'
|
||||
SELECT
|
||||
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName, bpi.pro_name as proName
|
||||
FROM
|
||||
tm_task tt
|
||||
LEFT JOIN sys_user su ON tt.create_by = su.user_name
|
||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||
LEFT JOIN bm_project_info bpi ON bpi.pro_id = bai.project_id
|
||||
WHERE
|
||||
tt.task_type = '29'
|
||||
<if test="record.taskId != null and record.taskId != '' ">
|
||||
AND tt.task_id = #{record.taskId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getAuditListByLeaseInfo" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyInfo">
|
||||
|
|
@ -465,9 +474,11 @@
|
|||
|
||||
<select id="getLeaseApplyDetails" resultType="com.bonus.sgzb.base.api.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
lad.*
|
||||
lad.*, mt.type_name AS typeModelName, mt1.type_name AS typeName
|
||||
FROM
|
||||
lease_apply_details lad
|
||||
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
WHERE
|
||||
lad.parennt_id = #{record.taskId} AND lad.company_id = #{record.companyId}
|
||||
</select>
|
||||
|
|
@ -483,17 +494,17 @@
|
|||
<trim suffixOverrides=",">
|
||||
<if test="record.companyAuditBy != null and record.companyAuditBy != ''">
|
||||
company_audit_by = #{record.companyAuditBy},
|
||||
company_audit_time = #{record.companyAuditTime},
|
||||
company_audit_time = now(),
|
||||
company_audit_remark = #{record.companyAuditRemark},
|
||||
</if>
|
||||
<if test="record.deptAuditBy != null and record.deptAuditBy != ''">
|
||||
dept_audit_by = #{record.companyAuditBy},
|
||||
dept_audit_time = #{record.companyAuditTime},
|
||||
dept_audit_time = now(),
|
||||
dept_audit_remark = #{record.companyAuditRemark},
|
||||
</if>
|
||||
<if test="record.directAuditBy != null and record.directAuditBy != ''">
|
||||
direct_audit_by = #{record.directAuditBy},
|
||||
direct_audit_time = #{record.directAuditTime}
|
||||
direct_audit_time = now()
|
||||
</if>
|
||||
</trim>
|
||||
WHERE
|
||||
|
|
@ -517,9 +528,7 @@
|
|||
<if test="record.updateBy != null and record.updateBy != '' ">
|
||||
update_by = #{record.updateBy},
|
||||
</if>
|
||||
<if test="record.updateTime!= null and record.updateTime != '' ">
|
||||
update_time = #{record.updateTime}
|
||||
</if>
|
||||
update_time = now()
|
||||
</trim>
|
||||
where
|
||||
parennt_id = #{record.parenntId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue