feat:合同配置

This commit is contained in:
苏竹红
2025-09-09 11:09:57 +08:00
parent 83ddafb842
commit 302d38af2b
10 changed files with 126 additions and 7 deletions

View File

@@ -304,10 +304,10 @@ public enum ErrorCodeEnum {
NOT_FLAGSHIP_STORE_NOT_EXIST(16100006,"当前阶段加盟类型不能变更!",null), NOT_FLAGSHIP_STORE_NOT_EXIST(16100006,"当前阶段加盟类型不能变更!",null),
CURRENT_BRAND_SORT_NUMBER_EXIST(16100007,"当前品牌已存在该排序数字!",null), CURRENT_BRAND_SORT_NUMBER_EXIST(16100007,"当前品牌已存在该排序数字!",null),
CONTRACT_CONFIG_NOT_EXIST(16100008,"合同配置不存在!",null),;
; ;
protected static final Map<Integer, ErrorCodeEnum> map = Arrays.stream(values()).collect( protected static final Map<Integer, ErrorCodeEnum> map = Arrays.stream(values()).collect(
Collectors.toMap(ErrorCodeEnum::getCode, Function.identity(), (a, b)->a)); Collectors.toMap(ErrorCodeEnum::getCode, Function.identity(), (a, b)->a));
private int code; private int code;

View File

@@ -18,6 +18,11 @@ public class ContractConfigDAO {
@Resource @Resource
private ContractConfigMapper contractConfigMapper; private ContractConfigMapper contractConfigMapper;
public ContractConfigDO queryContractConfigById(Long id){
return contractConfigMapper.selectByPrimaryKey(id);
}
public int addContractConfig(ContractConfigDO contractConfigDO){ public int addContractConfig(ContractConfigDO contractConfigDO){
return contractConfigMapper.insertSelective(contractConfigDO); return contractConfigMapper.insertSelective(contractConfigDO);
} }
@@ -37,7 +42,26 @@ public class ContractConfigDAO {
} }
/**
* 合同配置列表
* @param brand
* @return
*/
public List<ContractConfigDO> queryContractConfigList(String brand) { public List<ContractConfigDO> queryContractConfigList(String brand) {
return contractConfigMapper.queryContractConfigList(brand); return contractConfigMapper.queryContractConfigList(brand);
} }
/**
* 根据加盟品牌与加盟模式 查出所有的未删除状态的合并合同
* @param brand
* @param mode
* @return
*/
public List<ContractConfigDO> queryContractConfigListByBrandAndMode(String brand,String mode) {
return contractConfigMapper.queryContractConfigListByBrandAndMode(brand,mode);
}
public void deleteContractConfig(Long id) {
contractConfigMapper.deleteByPrimaryKey(id);
}
} }

View File

@@ -13,4 +13,6 @@ public interface ContractConfigMapper extends Mapper<ContractConfigDO> {
List<ContractConfigDO> queryContractConfigList(String brand); List<ContractConfigDO> queryContractConfigList(String brand);
List<ContractConfigDO> queryContractConfigListByBrandAndMode(String brand, String mode);
} }

View File

@@ -14,7 +14,7 @@
<result column="franchise_mode" jdbcType="VARCHAR" property="franchiseMode" /> <result column="franchise_mode" jdbcType="VARCHAR" property="franchiseMode" />
<result column="fadada_template_id" jdbcType="VARCHAR" property="fadadaTemplateId" /> <result column="fadada_template_id" jdbcType="VARCHAR" property="fadadaTemplateId" />
<result column="serial_number" jdbcType="INTEGER" property="serialNumber" /> <result column="serial_number" jdbcType="INTEGER" property="serialNumber" />
<result column="payee_name" javaType="VARCHAR" property="payeeName"/> <result column="payee_name" jdbcType="VARCHAR" property="payeeName"/>
<result column="deleted" jdbcType="TINYINT" property="deleted" /> <result column="deleted" jdbcType="TINYINT" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
@@ -31,4 +31,15 @@
and brand = #{brand} and brand = #{brand}
</if> </if>
</select> </select>
<select id="queryContractConfigListByBrandAndMode" resultMap="BaseResultMap">
select * from xfsg_contract_config
where deleted = 0
<if test="brand!=null and brand !=''">
and brand = #{brand}
</if>
<if test="mode!=null and mode !=''">
and franchise_mode like concat('%,',#{mode},',%')
</if>
</select>
</mapper> </mapper>

View File

@@ -32,7 +32,6 @@ public class ContractConfigDTO {
private String partyA; private String partyA;
@ApiModelProperty("乙方名称") @ApiModelProperty("乙方名称")
@NotBlank(message = "乙方名称不能为空")
private String partyB; private String partyB;
@ApiModelProperty(" 丙方名称") @ApiModelProperty(" 丙方名称")

View File

@@ -89,6 +89,14 @@ public class ContractConfigDO {
this.payeeName = payeeName; this.payeeName = payeeName;
} }
public Integer getDeleted() {
return deleted;
}
public void setDeleted(Integer deleted) {
this.deleted = deleted;
}
/** /**
* 获取主键ID * 获取主键ID
* *

View File

@@ -37,7 +37,12 @@ public interface ContractConfigService {
PageInfo<ContractListDTO> queryContractConfigList(QueryContractListDTO queryContractListDTO); PageInfo<ContractListDTO> queryContractConfigList(QueryContractListDTO queryContractListDTO);
/**
* 删除配置
* @param id
* @return
*/
Boolean deleteContractConfig(Long id);
} }

View File

@@ -8,6 +8,7 @@ import com.cool.store.entity.ContractConfigDO;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.service.ContractConfigService; import com.cool.store.service.ContractConfigService;
import com.cool.store.utils.poi.constant.Constants;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@@ -57,6 +58,7 @@ public class ContractConfigServiceImpl implements ContractConfigService {
String modelStr = addContractConfigDTO.getFranchiseModeList().stream().collect(Collectors.joining(",")); String modelStr = addContractConfigDTO.getFranchiseModeList().stream().collect(Collectors.joining(","));
contractConfigDO.setFranchiseMode("," + modelStr + ","); contractConfigDO.setFranchiseMode("," + modelStr + ",");
} }
contractConfigDAO.updateContractConfig(contractConfigDO);
return Boolean.TRUE; return Boolean.TRUE;
} }
@@ -78,5 +80,17 @@ public class ContractConfigServiceImpl implements ContractConfigService {
return contractConfigDOPageInfo; return contractConfigDOPageInfo;
} }
@Override
public Boolean deleteContractConfig(Long id) {
ContractConfigDO contractConfigDO = contractConfigDAO.queryContractConfigById(id);
if (contractConfigDO == null){
throw new ServiceException(ErrorCodeEnum.CONTRACT_CONFIG_NOT_EXIST);
}
contractConfigDO.setDeleted(Constants.ONE_INTEGER);
//修改配置状态
contractConfigDAO.updateContractConfig(contractConfigDO);
return Boolean.TRUE;
}
} }

View File

@@ -32,20 +32,17 @@ import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.CoolDateUtils; import com.cool.store.utils.CoolDateUtils;
import com.cool.store.utils.RedisConstantUtil; import com.cool.store.utils.RedisConstantUtil;
import com.cool.store.utils.RedisUtilPool; import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.UUIDUtils;
import com.cool.store.utils.poi.DateUtils; import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants; import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.LinePayVO; import com.cool.store.vo.LinePayVO;
import com.cool.store.vo.PartnerUserInfoVO; import com.cool.store.vo.PartnerUserInfoVO;
import jdk.nashorn.internal.codegen.types.BooleanType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@@ -0,0 +1,59 @@
package com.cool.store.controller.webb;
import com.cool.store.dto.contract.ContractConfigDTO;
import com.cool.store.dto.contract.ContractListDTO;
import com.cool.store.dto.contract.QueryContractListDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ContractConfigService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.xml.ws.Response;
/**
* @Author suzhuhong
* @Date 2025/9/9 10:03
* @Version 1.0
*/
@RestController
@RequestMapping("pc/contract")
@Api(tags = "PC-合同配置")
@Slf4j
public class ContractConfigController {
@Resource
private ContractConfigService contractConfigService;
@PostMapping("/addContractConfig")
@ApiOperation("添加合同配置")
public ResponseResult<Boolean> addContractConfig(@RequestBody @Validated ContractConfigDTO addContractConfigDTO) {
return ResponseResult.success(contractConfigService.addContractConfig(addContractConfigDTO));
}
@PostMapping("/updateContractConfig")
@ApiOperation("更新合同配置")
public ResponseResult<Boolean> updateContractConfig(@RequestBody @Validated ContractConfigDTO addContractConfigDTO) {
return ResponseResult.success(contractConfigService.updateContractConfig(addContractConfigDTO));
}
@PostMapping("/queryContractConfigList")
@ApiOperation("合同配置列表")
public ResponseResult<PageInfo<ContractListDTO>> queryContractConfigList(@RequestBody QueryContractListDTO queryContractListDTO) {
return ResponseResult.success(contractConfigService.queryContractConfigList(queryContractListDTO));
}
@GetMapping("/deleteContractConfig")
@ApiOperation("删除配置")
public ResponseResult<Boolean> deleteContractConfig(Long id) {
return ResponseResult.success(contractConfigService.deleteContractConfig(id));
}
}