Commit 0bb04771 by HlQ

[add]

1.添加查看合同绑定销售列表接口
2.项目日志添加字段
[chg] 项目绑定主合同接口逻辑修改,同时支持解绑主合同
1 parent ef02825d
......@@ -131,6 +131,13 @@ public class ContractController {
return contractService.dispatch(dto);
}
@GetMapping("/contract/sale")
@SaCheckPermission(value = "contract:sale:list", orRole = "admin")
// todo 未分配权限
public Page<RContractUser> getSaleList(RContractUser dto) {
return contractService.getSaleList(dto);
}
@PostMapping("/contract/assignSale")
@SaCheckPermission(value = "contract:assignSale", orRole = "admin")
// todo 未分配权限
......@@ -138,11 +145,11 @@ public class ContractController {
return contractService.assignSale(dto);
}
@DeleteMapping("/contract/unbindSale/{id}")
@PostMapping("/contract/unbindSale")
@SaCheckPermission(value = "contract:unbindSale", orRole = "admin")
// todo 未分配权限
public String unbindSale(@PathVariable Long id) {
return contractService.unbindSale(id);
public String unbindSale(@RequestBody RContractUser dto) {
return contractService.unbindSale(dto);
}
@PostMapping("/contractSync")
......
......@@ -87,7 +87,7 @@ public class StoreController {
@PostMapping("/store/bindContract")
@SaCheckPermission(value = "store:bindContract", orRole = "admin")
public String setMasterContract(@RequestBody StoreDTO dto) {
return storeService.updateById(converter.convert(dto, Store.class)) ? "绑定主合同成功" : "绑定主合同失败";
return storeService.lambdaUpdate().eq(Store::getId, dto.getId()).set(Store::getMasterContract, dto.getMasterContract()).update(new Store()) ? "绑定主合同成功" : "绑定主合同失败";
}
@GetMapping("/store/manualCal")
......
package vion.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import vion.dto.BaseDTO;
import java.util.Date;
/**
* @author HlQ
* @date 2023/12/28
*/
/**
* 合同与用户关联表(用户指的是销售)
*/
@Data
@TableName(value = "r_contract_user")
public class RContractUser {
public class RContractUser extends BaseDTO {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
......@@ -41,7 +38,7 @@ public class RContractUser {
/**
* 用户名
*/
@TableField(value = "username")
@TableField(value = "username", condition = SqlCondition.LIKE)
private String username;
/**
......@@ -54,8 +51,10 @@ public class RContractUser {
* 录入日期
*/
@TableField(value = "enter_date")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date enterDate;
@TableField(value = "create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
\ No newline at end of file
......@@ -22,10 +22,23 @@ public class StoreLog {
private Long storeId;
/**
* 备注
* 日志日期
*/
@TableField(value = "remark")
private String remark;
@TableField(value = "log_date")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date logDate;
/**
* 记录人
*/
@TableField(value = "create_user")
private Long createUser;
/**
* 内容
*/
@TableField(value = "content")
private String content;
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
......
......@@ -33,8 +33,10 @@ public interface IContractService extends MPJBaseService<Contract>{
String dispatch(@RequestBody RContractTeamDTO dto);
Page<RContractUser> getSaleList(RContractUser dto);
String assignSale(RContractUser contractUser);
String unbindSale(Long id);
String unbindSale(RContractUser contractUser);
}
\ No newline at end of file
......@@ -445,13 +445,18 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
}
@Override
public Page<RContractUser> getSaleList(RContractUser dto) {
return contractUserService.lambdaQuery(dto).orderByDesc(RContractUser::getEnterDate).page(Page.of(dto.getPageNum(), dto.getPageSize()));
}
@Override
public String assignSale(RContractUser contractUser) {
return contractUserService.save(contractUser) ? "分配成功" : "分配失败";
}
@Override
public String unbindSale(Long id) {
return contractUserService.removeById(id) ? "解绑成功" : "解绑失败";
public String unbindSale(RContractUser contractUser) {
return contractUserService.remove(Wrappers.<RContractUser>lambdaQuery().eq(RContractUser::getContractId, contractUser.getContractId()).eq(RContractUser::getUserId, contractUser.getUserId())) ? "解绑成功" : "解绑失败";
}
JSONObject buildMsg(String userid, Contract contract, String applicantName) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!