Commit 0bb04771 by HlQ

[add]

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