Merge remote-tracking branch 'origin/master'

This commit is contained in:
sxu 2024-12-16 12:11:57 +08:00
commit 84de6a0cc6
23 changed files with 208 additions and 13 deletions

View File

@ -106,6 +106,14 @@
<scope>test</scope>
</dependency>
<!-- Apache POI dependencies -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.3</version>
</dependency>
</dependencies>
<build>

View File

@ -29,8 +29,9 @@ public class BmContractController extends BaseController {
@ApiOperation(value = "合同列表")
@GetMapping("/list")
public AjaxResult list(BmContract bmContract) {
startPage();
List<BmContract> list = bmContractService.list(bmContract);
return AjaxResult.success(list);
return AjaxResult.success(getDataTable(list));
}
@ApiOperation(value = "合同新增")
@PostMapping("/add")
@ -63,4 +64,14 @@ public class BmContractController extends BaseController {
}
}
@ApiOperation(value = "合同状态修改(开启/关闭)")
@PostMapping("/updateStatus")
public AjaxResult updateStatus(@RequestBody BmContract bmContract) {
Integer i = bmContractService.updateStatus(bmContract);
if (i > 0){
return AjaxResult.success();
}else {
return AjaxResult.error();
}
}
}

View File

@ -27,11 +27,11 @@ public class BmContract {
private Integer status;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty(value = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
@ApiModelProperty(value = "用户id")
@ -40,6 +40,9 @@ public class BmContract {
@ApiModelProperty(value = "用户所属公司")
private Long ownerCom;
private String startTime;
private String endTime;
@ApiModelProperty(value = "文件附件")
private List<BmFileInfo> bmFileInfoList;
}

View File

@ -21,4 +21,8 @@ public interface BmContractMapper {
Integer del(BmContract bmContract);
String selectTaskNumByMonth(@Param("date") Date nowDate);
Integer updateStatus(BmContract bmContract);
Integer updateStatusOther(BmContract bmContract);
}

View File

@ -18,4 +18,6 @@ public interface BmContractService {
Integer edit(BmContract bmContract);
Integer del(BmContract bmContract);
Integer updateStatus(BmContract bmContract);
}

View File

@ -97,6 +97,24 @@ public class BmContractServiceImpl implements BmContractService {
return del;
}
@Override
public Integer updateStatus(BmContract bmContract) {
if (bmContract.getStatus() == 0) {
// 禁用
return bmContractMapper.updateStatus(bmContract);
} else {
// 开启
Integer i = bmContractMapper.updateStatus(bmContract);
if (i > 0) {
// 其他的禁用
bmContract.setOwnerCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
return bmContractMapper.updateStatusOther(bmContract);
} else {
return i;
}
}
}
private String getString() {
//根据前台传过来的数据生成需求编号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");

View File

@ -66,6 +66,9 @@ public class MaDevQc extends BaseEntity implements Serializable {
@ApiModelProperty(value = "上传人")
private String nickName;
@ApiModelProperty(value = "创建人所属公司")
private String qcCom;
@ApiModelProperty(value = "质检次数")
private Integer minNum;
private Integer maxNum;

View File

@ -63,6 +63,9 @@ public class MaDevRm extends BaseEntity implements Serializable {
@ApiModelProperty(value = "上传人")
private String nickName;
@ApiModelProperty(value = "上传人所属公司")
private String rmCom;
@ApiModelProperty(value = "维保次数")
private Integer minNum;
private Integer maxNum;

View File

@ -52,4 +52,7 @@ public class SafeBookInfo {
@ApiModelProperty(value = "上传人")
private String nickName;
@ApiModelProperty(value = "上传人所属公司")
private Integer uploadCom;
}

View File

@ -761,6 +761,7 @@ public class DevInfoServiceImpl implements DevInfoService {
@Override
public List<DevInfoVo> getTagDevList(DevInfoVo devInfoVo) {
devInfoVo.setOwnCo(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
return devInfoMapper.getTagDevList(devInfoVo);
}

View File

@ -44,6 +44,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
*/
@Override
public List<MaDevQc> selectDevQcList(MaDevQc maDevQc) {
maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
return maDevQcMapper.selectDevQcList(maDevQc);
}
@ -62,6 +63,7 @@ public class MaDevQcServiceImpl implements MaDevQcService {
maDevQc.setQcCode(code);
maDevQc.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
maDevQc.setCreateTime(DateUtils.getNowDate());
maDevQc.setQcCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
int result = maDevQcMapper.insertDevQc(maDevQc);
devInfoMapper.updateDevInfoIsQc(maDevQc);
if (result > 0 && maDevQc.getId() != null) {

View File

@ -36,11 +36,12 @@ public class MaDevRmServiceImpl implements MaDevRmService {
/**
* 装备质检列表
*
* @param maDevQc
* @param maDevRm
* @return
*/
@Override
public List<MaDevRm> selectDevQcList(MaDevRm maDevRm) {
maDevRm.setRmCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
return maDevRmMapper.selectDevQcList(maDevRm);
}
@ -59,6 +60,7 @@ public class MaDevRmServiceImpl implements MaDevRmService {
maDevRm.setRmCode(code);
maDevRm.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
maDevRm.setCreateTime(DateUtils.getNowDate());
maDevRm.setRmCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString());
int result = maDevRmMapper.insertDevQc(maDevRm);
// devInfoMapper.updateDevInfoIsQc(maDevRm);
if (result > 0 && maDevRm.getId() != null) {

View File

@ -37,6 +37,7 @@ public class SafeBookServiceImpl implements SafeBookService {
@Override
public List<SafeBookInfo> getSafeBookByMaId(SafeBookInfo safeBookInfo) {
safeBookInfo.setUploadCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
return safeBookMapper.getSafeBookByMaId(safeBookInfo);
}
@ -44,6 +45,7 @@ public class SafeBookServiceImpl implements SafeBookService {
public Integer addSafeBook(SafeBookInfo safeBookInfo) {
safeBookInfo.setCode(getString());
safeBookInfo.setUploadPerson(SecurityUtils.getLoginUser().getUserid());
safeBookInfo.setUploadCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId().intValue());
Integer i = safeBookMapper.addSafeBook(safeBookInfo);
devInfoMapper.updateDevInfoIsSafeBook(safeBookInfo);
if (i > 0) {

View File

@ -8,6 +8,8 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.book.domain.BookCarInfoDto;
import com.bonus.material.contract.domain.BmContract;
import com.bonus.material.contract.service.BmContractService;
import com.bonus.material.order.domain.OrderDetailCostReliefDto;
import com.bonus.material.order.domain.OrderDetailDto;
import com.bonus.material.order.domain.OrderInfoDto;
@ -16,10 +18,26 @@ import com.bonus.material.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;
/**
* @Authorliang.chao
@ -37,6 +55,9 @@ public class OrderController extends BaseController {
@Resource
private OrderMapper orderMapper;
@Resource
private BmContractService bmContractService;
/**
* 提交预约车到订单
*/
@ -141,4 +162,64 @@ public class OrderController extends BaseController {
return error("发起减免失败");
}
}
@ApiOperation(value = "租赁协议(查看)")
@PostMapping("/leaseAgreement")
public ResponseEntity<byte[]> getleaseAgreement(@RequestParam String orderId,
@RequestParam("file") MultipartFile file,
@RequestParam Map<String, String> replacements) throws IOException {
OrderInfoDto orderInfoDto = orderService.getAgreementByOrderId(orderId);
/* BmContract bmContract = new BmContract();
bmContract.setStatus(1);
List<BmContract> list = bmContractService.list(bmContract);
String wordUrl = list.get(0).getBmFileInfoList().get(0).getFileUrl();
InputStream inputStream = new URL(wordUrl).openStream();
XWPFDocument document = new XWPFDocument(inputStream);*/
XWPFDocument document = new XWPFDocument(file.getInputStream());
//订单日期
replacements.put("${orderTime}", orderInfoDto.getOrderTime().toString());
//装备所属公司
replacements.put("${czcompanyName}", orderInfoDto.getCzcompanyName());
//承租方所属公司
replacements.put("${companyName}", orderInfoDto.getCompanyName());
//订单金额
replacements.put("${cost}", orderInfoDto.getCost().toString());
for (IBodyElement element : document.getBodyElements()) {
if (element instanceof XWPFParagraph) {
XWPFParagraph paragraph = (XWPFParagraph) element;
for (XWPFRun run : paragraph.getRuns()) {
String text = run.getText(0);
if (text != null) {
for (Map.Entry<String, String> entry : replacements.entrySet()) {
text = text.replace(entry.getKey(), entry.getValue());
}
run.setText(text, 0);
}
}
}
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
document.write(outputStream);
byte[] wordBytes = outputStream.toByteArray();
// Convert Word to Image (simple example using BufferedImage)
BufferedImage image = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
graphics.setPaint(Color.white);
graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
graphics.setPaint(Color.black);
graphics.drawString(new String(wordBytes), 10, 20);
graphics.dispose();
ByteArrayOutputStream imageOutputStream = new ByteArrayOutputStream();
ImageIO.write(image, "png", imageOutputStream);
byte[] imageBytes = imageOutputStream.toByteArray();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.IMAGE_PNG);
return ResponseEntity.ok().headers(headers).body(imageBytes);
}
}

View File

@ -43,4 +43,6 @@ public interface OrderMapper {
int deleteCostReliefs(@Param("orderId") Integer orderId);
int insertCostReliefs(@Param("list") List<OrderDetailCostReliefDto> reliefList);
OrderInfoDto getAgreementByOrderId(String orderId);
}

View File

@ -19,4 +19,6 @@ public interface OrderService {
OrderInfoDto getOrderDetailsById(OrderDetailDto dto) throws Exception;
Integer submitCostRelief(OrderInfoDto orderInfoDto);
OrderInfoDto getAgreementByOrderId(String orderId);
}

View File

@ -106,8 +106,6 @@ public class OrderServiceImpl implements OrderService {
if (minOrderStatus.isPresent()) {
dto.setOrderStatus(minOrderStatus.get().getOrderStatus());
}
dto.setStartTime(list.get(0).getRentBeginTime());
dto.setEndTime(list.get(0).getRentEndTime());
//根据订单id去lease_repair_record表中查询是否已填写退租检修信息
int count = mapper.selectLeaseContent(String.valueOf(dto.getOrderId()));
if (count > 0) {
@ -144,4 +142,9 @@ public class OrderServiceImpl implements OrderService {
}
return 0;
}
@Override
public OrderInfoDto getAgreementByOrderId(String orderId) {
return orderMapper.getAgreementByOrderId(orderId);
}
}

View File

@ -9,12 +9,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="edit">
update bm_contract set
contract_name = #{contractName},
<if test="contractName != null and contractName != ''">contract_name = #{contractName},</if>
<if test="status != null">status = #{status},</if>
owner_id = #{ownerId},
owner_com = #{ownerCom},
update_time = now()
where id = #{id}
</update>
<update id="updateStatus">
update bm_contract set status = #{status} where id = #{id}
</update>
<update id="updateStatusOther">
update bm_contract set status = 0 where owner_com = #{ownerCom} and id != #{id}
</update>
<delete id="del">
delete from bm_contract where id = #{id}
</delete>
@ -29,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contractName != null and contractName != ''">
and contract_name like concat('%', #{contractName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND update_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
<if test="status != null">
and status = #{status}
</if>

View File

@ -763,6 +763,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
d.is_active = 1
AND d.ma_status !=0
AND d.own_co = #{ownCo}
<if test="code != null and code != ''">
and d.code like concat('%',#{code},'%')
</if>

View File

@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qcName != null and qcName != ''">qc_name,</if>
<if test="qcCode != null and qcCode != ''">qc_code,</if>
<if test="qcUser != null and qcUser != ''">qc_user,</if>
<if test="qcCom != null and qcCom != ''">qc_com,</if>
<if test="qcTime != null">qc_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@ -25,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="qcName != null and qcName != ''">#{qcName},</if>
<if test="qcCode != null and qcCode != ''">#{qcCode},</if>
<if test="qcUser != null and qcUser != ''">#{qcUser},</if>
<if test="qcCom != null and qcCom != ''">#{qcCom},</if>
<if test="qcTime != null">#{qcTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@ -78,6 +80,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
</if>
<if test="qcCom != null and qcCom != ''">
and m1.qc_com = #{qcCom}
</if>
</where>
</select>
<select id="selectQcList" resultType="com.bonus.material.device.domain.MaDevQc">

View File

@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rmTime != null">rm_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="rmCom != null and rmCom != ''">rm_com,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="maId != null">#{maId},</if>
@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rmTime != null">#{rmTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="rmCom != null and rmCom != ''">#{rmCom},</if>
</trim>
</insert>
@ -73,6 +75,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createStartTime != null and createStartTime != '' and createEndTime != null and createEndTime != ''">
and DATE_FORMAT(m1.create_time,'%Y-%m-%d') between #{createStartTime} and #{createEndTime}
</if>
<if test="rmCom != null and rmCom != ''">
and m1.rm_com = #{rmCom}
</if>
</where>
</select>
<select id="selectQcList" resultType="com.bonus.material.device.domain.MaDevRm">

View File

@ -4,8 +4,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.device.mapper.SafeBookMapper">
<insert id="addSafeBook" useGeneratedKeys="true" keyProperty="id">
insert into safe_book(code,ma_id,upload_person,create_time)
values(#{code},#{maId},#{uploadPerson},now())
insert into safe_book(code,ma_id,upload_person,create_time,upload_com)
values(#{code},#{maId},#{uploadPerson},now(),#{uploadCom})
</insert>
<update id="updateTime">
update safe_book set update_time = now() where ma_id = #{maId}
@ -30,6 +30,7 @@
WHERE
bfi.task_type = 17
AND bfi.file_type = 5
AND sb.upload_com = #{uploadCom}
<if test="code != null and code != ''">
and mdi.code like concat('%',#{code},'%')
</if>

View File

@ -271,6 +271,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
mt.del_flag = 0 and hh.order_id = #{orderId}
</select>
<select id="getAgreementByOrderId" resultType="com.bonus.material.order.domain.OrderInfoDto">
SELECT
moi.CODE AS CODE,
moi.order_time,
up.dept_name AS czcompanyName,
mdi.person_phone AS personPhone,
su.phonenumber AS phoneNumber,
moi.address,
moi.order_id,
sum( hh.costs ) cost,
dept.dept_name AS companyName
FROM
ma_order_details hh
LEFT JOIN ma_order_info moi ON moi.order_id = hh.order_id
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
LEFT JOIN sys_user su ON su.user_id = moi.buyer_id
LEFT JOIN sys_dept dept ON dept.dept_id = moi.buyer_company
LEFT JOIN sys_dept up ON up.dept_id = mdi.own_co
WHERE
mt.del_flag = '0'
AND hh.order_id = #{orderId}
</select>
<delete id="deleteCostReliefs">
delete from ma_order_details_relief