Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
40fe03f1b4
|
|
@ -52,7 +52,7 @@ public class BmContractController extends BaseController {
|
|||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
@ApiOperation(value = "合同修改")
|
||||
@ApiOperation(value = "合同删除")
|
||||
@PostMapping("/del")
|
||||
public AjaxResult del(@RequestBody BmContract bmContract) {
|
||||
Integer i = bmContractService.del(bmContract);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.material.contract.mapper;
|
||||
|
||||
import com.bonus.material.contract.domain.BmContract;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -17,4 +19,6 @@ public interface BmContractMapper {
|
|||
Integer edit(BmContract bmContract);
|
||||
|
||||
Integer del(BmContract bmContract);
|
||||
|
||||
String selectTaskNumByMonth(@Param("date") Date nowDate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.bonus.material.contract.service.impl;
|
|||
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.contract.domain.BmContract;
|
||||
import com.bonus.material.contract.mapper.BmContractMapper;
|
||||
|
|
@ -10,6 +12,8 @@ import com.bonus.material.device.mapper.BmFileInfoMapper;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -26,11 +30,20 @@ public class BmContractServiceImpl implements BmContractService {
|
|||
|
||||
@Override
|
||||
public List<BmContract> list(BmContract bmContract) {
|
||||
return bmContractMapper.list(bmContract);
|
||||
bmContract.setOwnerCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
List<BmContract> list = bmContractMapper.list(bmContract);
|
||||
for (BmContract contract : list) {
|
||||
BmFileInfo bmFileInfo = new BmFileInfo();
|
||||
bmFileInfo.setModelId(Long.valueOf(contract.getId())).setTaskType(MaterialConstants.APPENDICES_OF_CONTRACT).setFileType(0L);
|
||||
List<BmFileInfo> bmFileInfos = bmFileInfoMapper.selectBmFileInfoList(bmFileInfo);
|
||||
contract.setBmFileInfoList(bmFileInfos);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer add(BmContract bmContract) {
|
||||
bmContract.setContractCode(getString());
|
||||
bmContract.setOwnerId(SecurityUtils.getLoginUser().getUserid());
|
||||
bmContract.setOwnerCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
bmContract.setStatus(0);
|
||||
|
|
@ -83,4 +96,23 @@ public class BmContractServiceImpl implements BmContractService {
|
|||
}
|
||||
return del;
|
||||
}
|
||||
|
||||
private String getString() {
|
||||
//根据前台传过来的数据,生成需求编号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
String taskNum = bmContractMapper.selectTaskNumByMonth(nowDate);
|
||||
if (StringUtils.isNotBlank(taskNum)) {
|
||||
// 将字符串转换为整数
|
||||
int num = Integer.parseInt(taskNum);
|
||||
// 执行加一操作
|
||||
num++;
|
||||
// 将结果转换回字符串格式,并确保结果是4位数,不足4位则在前面补0
|
||||
taskNum = String.format("%04d", num);
|
||||
} else {
|
||||
taskNum = "0001";
|
||||
}
|
||||
return "HT" + format + "-" + taskNum;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,12 +22,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="list" resultType="com.bonus.material.contract.domain.BmContract">
|
||||
select id, contract_code as contractCode, contract_name as contractName, status, create_time as createTime, update_time as updateTime, owner_id as ownerId, owner_com as ownerCom from bm_contract
|
||||
<where>
|
||||
owner_com = #{ownerCom}
|
||||
<if test="contractCode != null and contractCode != ''">
|
||||
and contract_code like concat('%', #{contractCode}, '%')
|
||||
</if>
|
||||
<if test="contractName != null and contractName != ''">
|
||||
and contract_name like concat('%', #{contractName}, '%')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectTaskNumByMonth" resultType="java.lang.String">
|
||||
SELECT SUBSTRING(contract_code, - 4) as code
|
||||
FROM bm_contract
|
||||
WHERE DATE_FORMAT(create_time, '%y%m') = DATE_FORMAT(#{date}, '%y%m')
|
||||
ORDER BY create_time DESC LIMIT 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue