Compare commits
155 Commits
Author | SHA1 | Date |
---|---|---|
|
30d9abb786 | 3 years ago |
|
77681edd9c | 3 years ago |
|
6116742e7f | 3 years ago |
|
91a99d1c6b | 3 years ago |
|
ea1b8aca5a | 3 years ago |
|
2baaff82f6 | 3 years ago |
|
fc5252d845 | 3 years ago |
|
f80d27287c | 3 years ago |
|
0f87f11db9 | 3 years ago |
|
4d48476bdc | 3 years ago |
|
fcb3a06712 | 3 years ago |
|
4a229eba72 | 3 years ago |
|
c9d5cc8569 | 3 years ago |
|
fdf2c34650 | 3 years ago |
|
f464b2019d | 3 years ago |
|
64eb07ba85 | 3 years ago |
|
a5fc61c1ee | 3 years ago |
|
d0a5804886 | 3 years ago |
|
f6e9bfe4d3 | 3 years ago |
|
7e5814d0c1 | 3 years ago |
|
6b3498c36e | 3 years ago |
|
b4efd7c549 | 3 years ago |
|
a67a4d7ee7 | 3 years ago |
|
9021b348e6 | 3 years ago |
|
c5658e3ed8 | 3 years ago |
|
cd5fad7b0e | 3 years ago |
|
69b762739d | 3 years ago |
|
25d5409461 | 3 years ago |
|
d4d4cddc7b | 3 years ago |
|
aadfd3f16b | 3 years ago |
|
fcad070020 | 3 years ago |
|
81c165224a | 3 years ago |
|
37a297cfea | 3 years ago |
|
84bcbd47a3 | 3 years ago |
|
7ac9e0a83e | 3 years ago |
|
17f7005419 | 3 years ago |
|
c571508a2c | 3 years ago |
|
2aa076ef25 | 3 years ago |
|
5c199b3d37 | 3 years ago |
|
e0dc1e0f7d | 3 years ago |
|
458bea94d6 | 3 years ago |
|
13f73fa775 | 3 years ago |
|
2e2bf251ce | 3 years ago |
|
57a4f9e374 | 3 years ago |
|
83ed1ad205 | 3 years ago |
|
93ad55fbe2 | 3 years ago |
|
9f15e2964f | 3 years ago |
|
7ed18c1eb7 | 3 years ago |
|
f86cd4a9ee | 3 years ago |
|
c23b780525 | 3 years ago |
|
1a7a00acb0 | 3 years ago |
|
63e5febcb2 | 3 years ago |
|
67a792deed | 3 years ago |
|
bc8e36479c | 3 years ago |
|
d4a65d4012 | 3 years ago |
|
9fe63806a8 | 3 years ago |
|
4f18c35f60 | 3 years ago |
|
b3617a5543 | 3 years ago |
|
55c32bc6cf | 3 years ago |
|
b25ac0ab7e | 3 years ago |
|
ba29c4d83c | 3 years ago |
|
c5940b35be | 3 years ago |
|
289fc81f2b | 3 years ago |
|
436d95cb9d | 3 years ago |
|
e8d50a811c | 3 years ago |
|
4eec06cfd7 | 3 years ago |
|
25d9170707 | 3 years ago |
|
fa48a7bbf5 | 3 years ago |
|
3ea50426bd | 3 years ago |
|
d603c955ae | 3 years ago |
|
6634cff88b | 3 years ago |
|
173b2e2af5 | 3 years ago |
|
194fe5d5f5 | 3 years ago |
|
a74e43543a | 3 years ago |
|
a947ad7b2a | 3 years ago |
|
ea15990652 | 3 years ago |
|
880e22a341 | 3 years ago |
|
8745fc6266 | 3 years ago |
|
e5e0fdc0fa | 3 years ago |
|
150a479ae6 | 3 years ago |
|
3cfa6a267e | 3 years ago |
|
5d9b79869f | 3 years ago |
|
806043b16d | 3 years ago |
|
ec5d2dea83 | 3 years ago |
|
86818b9af3 | 3 years ago |
|
fb66ffda4b | 3 years ago |
|
7eb5b0f0a7 | 3 years ago |
|
a27a036e02 | 3 years ago |
|
2e37ac397a | 3 years ago |
|
0092bf4fe4 | 3 years ago |
|
d18a9c8e55 | 3 years ago |
|
0f4da50132 | 3 years ago |
|
ccfee004ce | 3 years ago |
|
17fdbeb7e5 | 3 years ago |
|
b3df55fbb2 | 3 years ago |
|
70d03f2b99 | 3 years ago |
|
051040927e | 3 years ago |
|
c8e7fe01e6 | 3 years ago |
|
cb965a044b | 3 years ago |
|
32b8a65d1b | 3 years ago |
|
ca7b4d7324 | 3 years ago |
|
ae517ad45d | 3 years ago |
|
db26d50338 | 3 years ago |
|
444cb767a0 | 3 years ago |
|
fc4bb62ab8 | 3 years ago |
|
07bb195ac3 | 3 years ago |
|
8c21f863f6 | 3 years ago |
|
f5c6876703 | 3 years ago |
|
028be59631 | 3 years ago |
|
a14f066133 | 3 years ago |
|
9d421952a6 | 3 years ago |
|
99918664a0 | 3 years ago |
|
0114dbd828 | 3 years ago |
|
3ea1d3404d | 3 years ago |
|
0d3d725485 | 3 years ago |
|
d392e7b4cd | 3 years ago |
|
dc235eccfb | 3 years ago |
|
16bcaae3d2 | 3 years ago |
|
d8ec321eeb | 3 years ago |
|
49cc00efdb | 3 years ago |
|
92632fe227 | 3 years ago |
|
177288726e | 3 years ago |
|
578198e4b4 | 3 years ago |
|
1aa4e8f5e6 | 3 years ago |
|
73931cbef5 | 3 years ago |
|
e765af265a | 3 years ago |
|
9ca400fe2d | 3 years ago |
|
26c5562312 | 3 years ago |
|
bedf257db0 | 3 years ago |
|
257c861c4d | 3 years ago |
|
1b0f5b249a | 3 years ago |
|
4b5fee97b7 | 3 years ago |
|
3c084657fa | 3 years ago |
|
55476a4b13 | 3 years ago |
|
6f90c65d6c | 3 years ago |
|
ac7f98e092 | 3 years ago |
|
a800502b9d | 3 years ago |
|
17aae6ae05 | 3 years ago |
|
33c79663fb | 3 years ago |
|
5106415afc | 3 years ago |
|
96ced34865 | 3 years ago |
|
1ec8928d5b | 3 years ago |
|
8a4c2922eb | 3 years ago |
|
bcb5010d45 | 3 years ago |
|
82d43987d5 | 3 years ago |
|
bc37ef77bc | 3 years ago |
|
33a376b6ac | 3 years ago |
|
fa1fb9eb85 | 3 years ago |
|
445e6095a7 | 3 years ago |
|
a6fa7db976 | 3 years ago |
|
a249821893 | 3 years ago |
|
faa1a41a78 | 3 years ago |
|
8dad0f7c1d | 3 years ago |
|
f7bc5b1f34 | 3 years ago |
|
ed172f9ab7 | 3 years ago |
527 changed files with 34617 additions and 705 deletions
@ -0,0 +1,26 @@ |
|||
package com.qs.serve.common.config.properties; |
|||
|
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author: YenHex |
|||
* @Date: 2021/3/3 |
|||
* @Version: 1.0 |
|||
**/ |
|||
@Getter |
|||
@Setter |
|||
@Component |
|||
@ConfigurationProperties(prefix = "project.seeyon") |
|||
public class SeeYonProperties { |
|||
|
|||
private Boolean enable; |
|||
|
|||
private String url; |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.qs.serve.common.framework.redis; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.data.redis.cache.RedisCache; |
|||
import org.springframework.data.redis.cache.RedisCacheConfiguration; |
|||
import org.springframework.data.redis.cache.RedisCacheManager; |
|||
import org.springframework.data.redis.cache.RedisCacheWriter; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import java.time.Duration; |
|||
|
|||
@Slf4j |
|||
public class TtlRedisCacheManager extends RedisCacheManager { |
|||
public TtlRedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration) { |
|||
super(cacheWriter, defaultCacheConfiguration); |
|||
} |
|||
|
|||
@Override |
|||
protected RedisCache createRedisCache(String name, RedisCacheConfiguration cacheConfig) { |
|||
log.debug("TtlRedisCacheManager keyName:{}",name); |
|||
String[] cells = StringUtils.delimitedListToStringArray(name, "="); |
|||
name = cells[0]; |
|||
if (cells.length > 1) { |
|||
long ttl = Long.parseLong(cells[1]); |
|||
// 根据传参设置缓存失效时间,默认单位是秒
|
|||
cacheConfig = cacheConfig.entryTtl(Duration.ofSeconds(ttl)); |
|||
} |
|||
return super.createRedisCache(name, cacheConfig); |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.common.model.consts; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/30 |
|||
*/ |
|||
public interface BudgetLogOptFlag { |
|||
|
|||
/** 0-预算新增;1-费用申请;2-预算调增;3-预算调减;4-费用释放;5-费用申请调增;6-费用申请调减 */ |
|||
Integer State_0 = 0; |
|||
Integer State_1 = 1; |
|||
Integer State_2 = 2; |
|||
Integer State_3 = 3; |
|||
Integer State_4 = 4; |
|||
Integer State_5 = 5; |
|||
Integer State_6 = 6; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.qs.serve.common.model.consts; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/1/30 |
|||
*/ |
|||
public interface BudgetLogRollbackFlag { |
|||
|
|||
/** 正常(标记为最新记录) */ |
|||
Integer State_0 = 0; |
|||
|
|||
/** 回退 */ |
|||
Integer State_1 = 1; |
|||
|
|||
/** 回退已处理 */ |
|||
Integer State_2 = 2; |
|||
|
|||
/** 删除已处理 */ |
|||
Integer State_3 = 3; |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.qs.serve.common.model.consts; |
|||
|
|||
/** |
|||
* 系统配置 |
|||
* @author YenHex |
|||
* @since 2022/11/12 |
|||
*/ |
|||
public interface SysConfigKey { |
|||
|
|||
/** 费用超支 */ |
|||
String TbsBudgetOverspend = "TbsBudgetOverspend"; |
|||
|
|||
/** 活动预计核销日期 */ |
|||
String ActivityPreCheckDays = "ActivityPreCheckDays"; |
|||
|
|||
} |
@ -0,0 +1,138 @@ |
|||
package com.qs.serve.common.util; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import lombok.experimental.UtilityClass; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.ParseException; |
|||
import org.apache.http.client.ClientProtocolException; |
|||
import org.apache.http.client.HttpClient; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpGet; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.StringEntity; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClientBuilder; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.protocol.HTTP; |
|||
import org.apache.http.util.EntityUtils; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.HashMap; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/23 |
|||
*/ |
|||
@Slf4j |
|||
@UtilityClass |
|||
public class HttpUtil { |
|||
|
|||
private final static String CONTENT_TYPE = "application/json"; |
|||
private final static String CHARSET = "UTF-8"; |
|||
private final static String EN_CONING = "UTF-8"; |
|||
|
|||
public static String doPost(String url, String jsonStr, HashMap<String,String> headers) { |
|||
CloseableHttpClient client = HttpClientBuilder.create().build(); |
|||
CloseableHttpResponse response = null; |
|||
try { |
|||
//设post请求
|
|||
HttpPost post = new HttpPost(url); |
|||
//创建请求实体传参
|
|||
StringEntity postingString = new StringEntity(jsonStr,CHARSET); |
|||
postingString.setContentEncoding(EN_CONING); |
|||
//设置post请求参数
|
|||
post.setEntity(postingString); |
|||
post.addHeader(HTTP.CONTENT_TYPE,CONTENT_TYPE); |
|||
if (headers != null) { |
|||
for (String key : headers.keySet()) { |
|||
post.addHeader(key,headers.get(key)); |
|||
} |
|||
} |
|||
//执行post请求
|
|||
response = client.execute(post); |
|||
//访问成功状态码为200
|
|||
if (response.getStatusLine().getStatusCode() == 200) { |
|||
return EntityUtils.toString(response.getEntity()); |
|||
} |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
}finally { |
|||
try { |
|||
client.close(); |
|||
if(response!=null){ |
|||
response.close(); |
|||
} |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static String doGet(String url, HashMap<String,String> headers) { |
|||
CloseableHttpClient httpclient = HttpClients.createDefault(); |
|||
try { |
|||
HttpGet httpget = new HttpGet(url); |
|||
httpget.addHeader(HTTP.CONTENT_TYPE,CONTENT_TYPE); |
|||
if (headers != null) { |
|||
for (String key : headers.keySet()) { |
|||
httpget.addHeader(key,headers.get(key)); |
|||
} |
|||
} |
|||
CloseableHttpResponse response = httpclient.execute(httpget); |
|||
try { |
|||
if (response.getStatusLine().getStatusCode() == 200) { |
|||
return EntityUtils.toString(response.getEntity()); |
|||
} |
|||
} finally { |
|||
response.close(); |
|||
} |
|||
} catch (ClientProtocolException e) { |
|||
e.printStackTrace(); |
|||
} catch (ParseException e) { |
|||
e.printStackTrace(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} finally { |
|||
try { |
|||
httpclient.close(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
public static String createUrl(HashMap<String,String> param){ |
|||
StringBuilder sb = new StringBuilder(); |
|||
for (String key : param.keySet()) { |
|||
sb.append("&"+key+"="+param.get(key)); |
|||
} |
|||
return sb.toString(); |
|||
} |
|||
|
|||
public static R<String> doGetResult(String url,HashMap<String,String> headers){ |
|||
String result = HttpUtil.doGet(url,headers); |
|||
JSONObject jsonObject = JSONObject.parseObject(result); |
|||
Integer status = jsonObject.getInteger("status"); |
|||
String msg = jsonObject.getString("msg"); |
|||
String data = jsonObject.getString("data"); |
|||
return new R(status,msg,data); |
|||
} |
|||
|
|||
public static R<String> doPostResult(String url, String jsonStr, HashMap<String,String> headers){ |
|||
String result = HttpUtil.doPost(url,jsonStr,headers); |
|||
log.debug("url:{},result:{}",url,result); |
|||
if(result==null){ |
|||
Assert.throwEx("远程服务连接失败"); |
|||
} |
|||
JSONObject jsonObject = JSONObject.parseObject(result); |
|||
Integer status = jsonObject.getInteger("status"); |
|||
String msg = jsonObject.getString("msg"); |
|||
String data = jsonObject.getString("data"); |
|||
return new R(status,msg,data); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,85 @@ |
|||
package com.qs.serve.common.util; |
|||
|
|||
import com.qs.serve.common.framework.exception.BusinessException; |
|||
import lombok.experimental.UtilityClass; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.hibernate.validator.HibernateValidator; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import javax.validation.ConstraintViolation; |
|||
import javax.validation.Validation; |
|||
import javax.validation.Validator; |
|||
import javax.validation.ValidatorFactory; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
/** |
|||
* validate方法中校验工具类 |
|||
* <p> |
|||
* 只要在实体中加上相应的validate的相关注解即可 |
|||
* </p> |
|||
* |
|||
* @author Zed |
|||
*/ |
|||
@UtilityClass |
|||
public class ValidateTools { |
|||
/** |
|||
* 初始化检查器 |
|||
*/ |
|||
private static final ValidatorFactory VALIDATOR_FACTORY = Validation.byProvider(HibernateValidator.class).configure().failFast(false).buildValidatorFactory(); |
|||
private static final Validator VALIDATOR = VALIDATOR_FACTORY.getValidator(); |
|||
/** |
|||
* 校验返回异常信息 |
|||
* |
|||
* @param t 实体 |
|||
* @param <T> 实体泛型 |
|||
*/ |
|||
public static <T> String validStr(T t) { |
|||
// 构造返回信息
|
|||
StringBuilder validMessage = new StringBuilder(); |
|||
// 检查实体T
|
|||
Set<ConstraintViolation<T>> set = VALIDATOR.validate(t); |
|||
// 循环set,获取检查结果
|
|||
for (ConstraintViolation<T> vo : set) { |
|||
validMessage.append(vo.getMessage()).append(";"); |
|||
} |
|||
return validMessage.toString(); |
|||
} |
|||
/** |
|||
* 校验实体抛出异常 |
|||
* |
|||
* @param t 实体 |
|||
* @param <T> 实体泛型 |
|||
*/ |
|||
public static <T> void valid(T t) { |
|||
String validStr = validStr(t); |
|||
// 抛出业务异常
|
|||
if (StringUtils.isNotBlank(validStr)) { |
|||
throw new BusinessException(validStr,500); |
|||
} |
|||
} |
|||
/** |
|||
* 校验集合抛出异常 |
|||
* |
|||
* @param list 列表 |
|||
* @param <T> 实体泛型 |
|||
*/ |
|||
public static <T> void valid(List<T> list) { |
|||
if (CollectionUtils.isEmpty(list)) { |
|||
throw new BusinessException("数据不存在!",500); |
|||
} |
|||
// 构造返回信息
|
|||
StringBuilder validMessageTotal = new StringBuilder(); |
|||
// 遍历
|
|||
for (int i = 0; i < list.size(); i++) { |
|||
String validStr = validStr(list.get(i)); |
|||
if (StringUtils.isNotBlank(validStr)) { |
|||
String msg = String.format("第%d条数据校验结果:[%s]\n", i + 1, validStr); |
|||
validMessageTotal.append(msg); |
|||
} |
|||
} |
|||
// 抛出业务异常
|
|||
if (StringUtils.isNotBlank(validMessageTotal.toString())) { |
|||
throw new BusinessException(validMessageTotal.toString(),500); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,122 @@ |
|||
package com.qs.serve.modules.base.controller; |
|||
|
|||
import cn.hutool.crypto.SecureUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.consts.GySysConst; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.AuthContextUtils; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.ValidateTools; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSupplierBatchBo; |
|||
import com.qs.serve.modules.bms.mapper.BmsSupplierMapper; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import com.qs.serve.modules.goods.entity.bo.GoodsSpuBatchTasteBo; |
|||
import com.qs.serve.modules.goods.service.GoodsSpuService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.entity.bo.SysUserBatchBo; |
|||
import com.qs.serve.modules.sys.entity.bo.SysUserBo; |
|||
import com.qs.serve.modules.sys.service.SysRoleService; |
|||
import com.qs.serve.modules.sys.service.SysUserSalesService; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.validation.Valid; |
|||
|
|||
/** |
|||
* 【嘉士利对接】 |
|||
* @author YenHex |
|||
* @since 2022/10/28 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/jsl") |
|||
public class JslApiController { |
|||
|
|||
private SysUserService sysUserService; |
|||
private SysRoleService sysRoleService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
private SysUserSalesService sysUserSalesService; |
|||
private GoodsSpuService goodsSpuService; |
|||
|
|||
/** |
|||
* 客户档案 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/supplier/editBatch") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplier:insert')") |
|||
public R<?> editBatch(@RequestBody @Valid BmsSupplierBatchBo param){ |
|||
bmsSupplierService.editBatch(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 业务员档案 |
|||
* @param batchBo |
|||
* @return |
|||
*/ |
|||
@SysLog(title = "人员",desc = "用户新增",biz = BizType.INSERT) |
|||
@PostMapping("/user/editBatch") |
|||
@PreAuthorize("hasRole('sys:user:insert')") |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public R<?> saveBatch(@RequestBody @Valid SysUserBatchBo batchBo){ |
|||
for (SysUserBo userBo : batchBo.getUserList()) { |
|||
SysUser dbData = sysUserService.getById(userBo.getId()); |
|||
SysUser param = CopierUtil.copy(userBo,dbData==null?new SysUser():dbData); |
|||
//设置普通管理员
|
|||
param.setSuperFlag(0); |
|||
param.setTenantId(AuthContextUtils.getTenant()); |
|||
param.setAccount(param.getMobile()); |
|||
param.setPassword(SecureUtil.md5(GySysConst.DEFAULT_PASSWORD)); |
|||
if(param.getMobile()!=null){ |
|||
param.setAccount(param.getMobile()); |
|||
} |
|||
//检查手机号是否已用
|
|||
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.ne(SysUser::getId,userBo.getId()); |
|||
wrapper.eq(SysUser::getMobile,param.getMobile()); |
|||
Long count = sysUserService.count(wrapper); |
|||
if(count>0L){ |
|||
return R.error("手机号已被注册"); |
|||
} |
|||
if(dbData == null){ |
|||
sysUserService.save(param); |
|||
}else { |
|||
sysUserService.updateById(param); |
|||
} |
|||
if(param.getId()!=null&& com.qs.serve.common.util.CollectionUtil.isNotEmpty(userBo.getRoleIds())){ |
|||
sysRoleService.saveUserRole4Edit(userBo.getRoleIds(),param.getId()); |
|||
} |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* (批量)编辑口味品类SPU,建议每次小于50条 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/saveBatchTasteSpu") |
|||
@SysLog(module = SystemModule.GOODS, title = "spu", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('goods:spu:insert')") |
|||
public R<?> saveBatchTasteSpu(@RequestBody GoodsSpuBatchTasteBo param){ |
|||
ValidateTools.valid(param.getTasteProducts()); |
|||
return R.ok(goodsSpuService.saveBatchTasteSpu(param)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,103 @@ |
|||
package com.qs.serve.modules.biz.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.biz.entity.BizVisit; |
|||
import com.qs.serve.modules.biz.service.BizVisitService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 业务 拜访日志 |
|||
* @author YenHex |
|||
* @since 2022-10-26 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("biz/visit") |
|||
public class BizVisitController { |
|||
|
|||
private BizVisitService bizVisitService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('biz:visit:query')") |
|||
public R<PageVo<BizVisit>> getPage(BizVisit param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BizVisit> visitWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BizVisit> list = bizVisitService.list(visitWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('biz:visit:query')") |
|||
public R<BizVisit> getById(@PathVariable("id") String id){ |
|||
BizVisit bizVisit = bizVisitService.getById(id); |
|||
return R.ok(bizVisit); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('biz:visit:update')") |
|||
public R<?> updateById(@RequestBody @Valid BizVisit param){ |
|||
boolean result = bizVisitService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('biz:visit:insert')") |
|||
public R<?> save(@RequestBody @Valid BizVisit param){ |
|||
boolean result = bizVisitService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BIZ, title = "拜访日志", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('biz:visit:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
boolean result = bizVisitService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,139 @@ |
|||
package com.qs.serve.modules.biz.controller.api; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.biz.entity.BizVisit; |
|||
import com.qs.serve.modules.biz.service.BizVisitService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import com.qs.serve.modules.wx.entity.WxUser; |
|||
import com.qs.serve.modules.wx.service.WxUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* API业务 拜访日志 |
|||
* @author YenHex |
|||
* @since 2022-10-26 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/api/visit") |
|||
public class BizVisitApi { |
|||
|
|||
private BizVisitService bizVisitService; |
|||
private WxUserService wxUserService; |
|||
private SysUserService sysUserService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BizVisit>> getPage(BizVisit param){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.byEmptyList(); |
|||
} |
|||
String userId = wxUser.getSysUserId(); |
|||
param.setVisitorId(userId); |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BizVisit> visitWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BizVisit> list = bizVisitService.list(visitWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BizVisit> getById(@PathVariable("id") String id){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.ok(); |
|||
} |
|||
String userId = wxUser.getSysUserId(); |
|||
BizVisit bizVisit = bizVisitService.getById(id); |
|||
if(!bizVisit.getVisitorId().equals(userId)){ |
|||
return R.ok(); |
|||
} |
|||
return R.ok(bizVisit); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
public R<?> updateById(@RequestBody @Valid BizVisit param){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.ok(); |
|||
} |
|||
String userId = wxUser.getSysUserId(); |
|||
BizVisit bizVisit = bizVisitService.getById(param.getId()); |
|||
if(!bizVisit.getVisitorId().equals(userId)){ |
|||
return R.ok(); |
|||
} |
|||
boolean result = bizVisitService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid BizVisit param){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.ok(); |
|||
} |
|||
String userId = wxUser.getSysUserId(); |
|||
SysUser sysUser = sysUserService.getById(userId); |
|||
param.setVisitorId(userId); |
|||
param.setVisitorName(sysUser.getName()); |
|||
boolean result = bizVisitService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.ok(); |
|||
} |
|||
String userId = wxUser.getSysUserId(); |
|||
BizVisit bizVisit = bizVisitService.getById(id); |
|||
if(!bizVisit.getVisitorId().equals(userId)){ |
|||
return R.ok(); |
|||
} |
|||
boolean result = bizVisitService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,97 @@ |
|||
package com.qs.serve.modules.biz.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
|||
import lombok.Data; |
|||
import org.apache.ibatis.type.JdbcType; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 拜访日志 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-26 |
|||
*/ |
|||
@Data |
|||
@TableName(value = "biz_visit",autoResultMap = true) |
|||
public class BizVisit implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 图片 */ |
|||
@TableField(typeHandler = SplitStringTypeHandler.class,jdbcType= JdbcType.VARCHAR) |
|||
private String[] photos; |
|||
|
|||
/** 纬度 */ |
|||
@Length(max = 255,message = "纬度长度不能超过255字") |
|||
private String localX; |
|||
|
|||
/** 经度 */ |
|||
@Length(max = 255,message = "经度长度不能超过255字") |
|||
private String localY; |
|||
|
|||
/** 地址 */ |
|||
@Length(max = 512,message = "地址长度不能超过512字") |
|||
private String address; |
|||
|
|||
/** 类型:单选 【潜在客户签到;培训会议;其他定点签到;在家办公 】 */ |
|||
@Length(max = 255,message = "类型:单选 【潜在客户签到;培训会议;其他定点签到;在家办公 】长度不能超过255字") |
|||
private String signType; |
|||
|
|||
/** 拜访人id */ |
|||
@Length(max = 32,message = "拜访人id长度不能超过32字") |
|||
private String visitorId; |
|||
|
|||
/** 拜访人 */ |
|||
@Length(max = 32,message = "拜访人长度不能超过32字") |
|||
private String visitorName; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.biz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.biz.entity.BizVisit; |
|||
|
|||
/** |
|||
* 拜访日志 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-26 |
|||
*/ |
|||
public interface BizVisitMapper extends BaseMapper<BizVisit> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.biz.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.biz.entity.BizVisit; |
|||
|
|||
/** |
|||
* 拜访日志 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-10-26 |
|||
*/ |
|||
public interface BizVisitService extends IService<BizVisit> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.biz.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.biz.entity.BizVisit; |
|||
import com.qs.serve.modules.biz.service.BizVisitService; |
|||
import com.qs.serve.modules.biz.mapper.BizVisitMapper; |
|||
|
|||
/** |
|||
* 拜访日志 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-10-26 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BizVisitServiceImpl extends ServiceImpl<BizVisitMapper,BizVisit> implements BizVisitService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,6 @@ |
|||
package com.qs.serve.modules.bms.common; |
|||
|
|||
public interface FactoryIdOperation { |
|||
String Add = "Add"; |
|||
String Del = "del"; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.qs.serve.modules.bms.common; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
public interface MasterUserType { |
|||
|
|||
String Channel = "channel"; |
|||
|
|||
String Point = "point"; |
|||
|
|||
String Center = "center"; |
|||
|
|||
} |
@ -0,0 +1,124 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|||
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|||
import com.qs.serve.modules.tbs.entity.TbsActivityChannel; |
|||
import com.qs.serve.modules.tbs.service.TbsActivityChannelService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 渠道 |
|||
* @author YenHex |
|||
* @since 2022-11-03 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/channel") |
|||
public class BmsChannelController { |
|||
|
|||
private BmsChannelService bmsChannelService; |
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private TbsActivityChannelService activityChannelService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:channel:query')") |
|||
public R<PageVo<BmsChannel>> getPage(BmsChannel param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsChannel> channelWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsChannel> list = bmsChannelService.list(channelWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:channel:query')") |
|||
public R<BmsChannel> getById(@PathVariable("id") String id){ |
|||
BmsChannel bmsChannel = bmsChannelService.getById(id); |
|||
return R.ok(bmsChannel); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:channel:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsChannel param){ |
|||
BmsChannel ori = bmsChannelService.getById(param.getId()); |
|||
boolean result = bmsChannelService.updateById(param); |
|||
if(!ori.getChannelName().equals(param.getChannelName())){ |
|||
List<BmsChannelPoint> channelPoints = bmsChannelPointService.listByChannelId(param.getId()); |
|||
channelPoints = channelPoints.stream().map(a->{ |
|||
a.setChannelName(param.getChannelName()); |
|||
return a; |
|||
}).collect(Collectors.toList()); |
|||
bmsChannelPointService.updateBatchById(channelPoints); |
|||
} |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:channel:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsChannel param){ |
|||
boolean result = bmsChannelService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:channel:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
LambdaQueryWrapper<TbsActivityChannel> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(TbsActivityChannel::getChannelId,id); |
|||
if(activityChannelService.count()>0){ |
|||
return R.error("活动含当前渠道,删除失败"); |
|||
} |
|||
boolean result = bmsChannelService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,141 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion2; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsChannelPointBo; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
import com.qs.serve.modules.bms.service.BmsRegion2Service; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
import com.qs.serve.modules.tbs.entity.TbsActivityChannelPoint; |
|||
import com.qs.serve.modules.tbs.service.TbsActivityChannelPointService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|||
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 渠道站点 |
|||
* @author YenHex |
|||
* @since 2022-11-03 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/channelPoint") |
|||
public class BmsChannelPointController { |
|||
|
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private BmsRegionService bmsRegionService; |
|||
private BmsRegion2Service bmsRegion2Service; |
|||
private TbsActivityChannelPointService activityChannelPointService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:channelPoint:query')") |
|||
public R<PageVo<BmsChannelPoint>> getPage(BmsChannelPoint param){ |
|||
PageUtil.startPage(); |
|||
List<BmsChannelPoint> list = bmsChannelPointService.selectChannelPointList(param); |
|||
for (BmsChannelPoint channelPoint : list) { |
|||
if(StringUtils.hasText(channelPoint.getBizRegionPath())){ |
|||
String[] bizRegions = channelPoint.getBizRegionPath().split("_"); |
|||
if(bizRegions.length>0){ |
|||
channelPoint.setBizRegionName(bizRegions[bizRegions.length-1]); |
|||
} |
|||
} |
|||
if(StringUtils.hasText(channelPoint.getSaleRegionPath())){ |
|||
String[] regions = channelPoint.getSaleRegionPath().split("_"); |
|||
if(regions.length>0){ |
|||
channelPoint.setSaleRegionName(regions[regions.length-1]); |
|||
} |
|||
} |
|||
} |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道站点", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:channelPoint:query')") |
|||
public R<BmsChannelPoint> getById(@PathVariable("id") String id){ |
|||
BmsChannelPoint bmsChannelPoint = bmsChannelPointService.getById(id); |
|||
BmsRegion bmsRegion = bmsRegionService.getById(bmsChannelPoint.getSaleRegionId()); |
|||
if(bmsRegion!=null){ |
|||
bmsChannelPoint.setSaleRegionName(bmsRegion.getName()); |
|||
} |
|||
BmsRegion2 bmsRegion2 = bmsRegion2Service.getById(bmsChannelPoint.getBizRegionId()); |
|||
if(bmsRegion2!=null){ |
|||
bmsChannelPoint.setBizRegionName(bmsRegion2.getName()); |
|||
} |
|||
return R.ok(bmsChannelPoint); |
|||
} |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道站点", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:channelPoint:update')") |
|||
public R<?> updateById(@RequestBody BmsChannelPointBo param){ |
|||
return R.isTrue(bmsChannelPointService.modify(param)); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道站点", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:channelPoint:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsChannelPointBo param){ |
|||
boolean result = bmsChannelPointService.modify(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "渠道站点", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:channelPoint:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
LambdaQueryWrapper<TbsActivityChannelPoint> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(TbsActivityChannelPoint::getPointId,id); |
|||
if(activityChannelPointService.count(lqw)>0){ |
|||
return R.error("活动含当前站点,删除失败"); |
|||
} |
|||
boolean result = bmsChannelPointService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,214 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.common.MasterUserType; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsCostCenterBo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsCostCenterTreeVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserCenterVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsSubjectTreeVo; |
|||
import com.qs.serve.modules.bms.service.BmsMasterUserService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.tbs.common.TbsCenterType; |
|||
import com.qs.serve.modules.tbs.entity.TbsActivityCenter; |
|||
import com.qs.serve.modules.tbs.service.TbsActivityCenterService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsCostCenter; |
|||
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 成本中心 |
|||
* @author YenHex |
|||
* @since 2022-10-13 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/costCenter") |
|||
public class BmsCostCenterController { |
|||
|
|||
private BmsCostCenterService bmsCostCenterService; |
|||
private BmsMasterUserService bmsMasterUserService; |
|||
private TbsActivityCenterService activityCenterService; |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param loadByCurrent 值=1,过滤当前用户负责数据 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:costCenter:query')") |
|||
public R<List<BmsCostCenterTreeVo>> getTree(Integer loadByCurrent){ |
|||
if(loadByCurrent!=null&&loadByCurrent.equals(1)){ |
|||
return getTreeByCurrentUser(); |
|||
} |
|||
List<BmsCostCenter> list = bmsCostCenterService.list(); |
|||
List<BmsCostCenterTreeVo> treeVoList = list.stream().map(obj->{ |
|||
BmsCostCenterTreeVo treeNode = CopierUtil.copy(obj,new BmsCostCenterTreeVo()); |
|||
treeNode.setId(obj.getId().toString()); |
|||
treeNode.setParentId(obj.getPid().toString()); |
|||
treeNode.setSort(0); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
return R.ok(TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING)); |
|||
} |
|||
|
|||
|
|||
public R<List<BmsCostCenterTreeVo>> getTreeByCurrentUser(){ |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
LambdaQueryWrapper<BmsMasterUser> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsMasterUser::getUserId,userId); |
|||
lqw.eq(BmsMasterUser::getType, MasterUserType.Center); |
|||
List<BmsMasterUser> masterUsers = bmsMasterUserService.list(lqw); |
|||
List<String> centerIds = masterUsers.stream().map(BmsMasterUser::getTargetId).collect(Collectors.toList()); |
|||
if(centerIds.size()>0){ |
|||
List<BmsCostCenter> costCenters = bmsCostCenterService.listByIds(centerIds); |
|||
Map<Integer,List<BmsCostCenter>> listMap = costCenters.stream().collect(Collectors.groupingBy(BmsCostCenter::getLevel)); |
|||
List<BmsCostCenter> list1 = listMap.get(1)==null?new ArrayList<>():listMap.get(1); |
|||
List<BmsCostCenter> list2 = listMap.get(2)==null?new ArrayList<>():listMap.get(2); |
|||
List<BmsCostCenter> list3 = listMap.get(3)==null?new ArrayList<>():listMap.get(3); |
|||
list3.forEach(obj3->{ |
|||
boolean exist = false; |
|||
for (BmsCostCenter obj2 : list2) { |
|||
if(obj2.getId().equals(obj3.getPid())){ |
|||
List<BmsCostCenter> childList = obj2.getChildNode()==null?new ArrayList<>():obj2.getChildNode(); |
|||
childList.add(obj3); |
|||
obj2.setChildNode(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list2.add(obj3); |
|||
} |
|||
}); |
|||
list2.forEach(obj2->{ |
|||
boolean exist = false; |
|||
for (BmsCostCenter obj1 : list1) { |
|||
if(obj1.getId().equals(obj2.getPid())){ |
|||
List<BmsCostCenter> childList = obj1.getChildNode()==null?new ArrayList<>():obj1.getChildNode(); |
|||
childList.add(obj2); |
|||
obj1.setChildNode(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list1.add(obj2); |
|||
} |
|||
}); |
|||
List<BmsCostCenterTreeVo> treeVoList = toTreeNode(list1); |
|||
return R.ok(treeVoList); |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
private List<BmsCostCenterTreeVo> toTreeNode(List<BmsCostCenter> list){ |
|||
List<BmsCostCenterTreeVo> treeVoList = new ArrayList<>(); |
|||
for (BmsCostCenter costCenter : list) { |
|||
BmsCostCenterTreeVo treeNode = CopierUtil.copy(costCenter,new BmsCostCenterTreeVo()); |
|||
treeNode.setId(costCenter.getId().toString()); |
|||
treeNode.setParentId(costCenter.getPid().toString()); |
|||
treeNode.setSort(0); |
|||
if(CollectionUtil.isNotEmpty(costCenter.getChildNode())){ |
|||
List<BmsCostCenterTreeVo> childList = toTreeNode(costCenter.getChildNode()); |
|||
for (BmsCostCenterTreeVo treeVo : childList) { |
|||
treeNode.addChildren(treeVo); |
|||
} |
|||
} |
|||
treeVoList.add(treeNode); |
|||
} |
|||
return treeVoList; |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:costCenter:query')") |
|||
public R<BmsCostCenter> getById(@PathVariable("id") String id){ |
|||
BmsCostCenter bmsCostCenter = bmsCostCenterService.getById(id); |
|||
return R.ok(bmsCostCenter); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:costCenter:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsCostCenterBo param){ |
|||
commonEdit(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
private void commonEdit(BmsCostCenterBo param){ |
|||
BmsCostCenter costCenter = CopierUtil.copy(param,new BmsCostCenter()); |
|||
if(costCenter.getPid()==null||costCenter.getPid().equals(0L)){ |
|||
costCenter.setPid(0L); |
|||
costCenter.setLevel(1); |
|||
}else { |
|||
BmsCostCenter parent = bmsCostCenterService.getById(costCenter.getPid()); |
|||
costCenter.setLevel(parent.getLevel()+1); |
|||
} |
|||
bmsCostCenterService.saveOrUpdate(costCenter); |
|||
} |
|||
|
|||
/** |
|||
* 新增成本中心 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:costCenter:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsCostCenterBo param){ |
|||
commonEdit(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除成本中心 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:costCenter:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
//未校验已用不能删,预算和费用申请
|
|||
LambdaQueryWrapper<TbsActivityCenter> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(TbsActivityCenter::getCenterId,id); |
|||
lqw.eq(TbsActivityCenter::getCenterType, TbsCenterType.center.name()); |
|||
if(activityCenterService.count(lqw)>0){ |
|||
return R.error("活动含当前成本中心,删除失败"); |
|||
} |
|||
boolean result = bmsCostCenterService.removeSelfAndChildById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,112 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CollectionUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.bms.common.FactoryIdOperation; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
import com.qs.serve.modules.goods.service.GoodsSpecValueService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsFactory; |
|||
import com.qs.serve.modules.bms.service.BmsFactoryService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 工厂产地 |
|||
* @author YenHex |
|||
* @since 2022-10-20 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/factory") |
|||
public class BmsFactoryController { |
|||
|
|||
private BmsFactoryService bmsFactoryService; |
|||
private BmsRegionService bmsRegionService; |
|||
private GoodsSpecValueService goodsSpecValueService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:factory:query')") |
|||
public R<PageVo<BmsFactory>> getPage(BmsFactory param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsFactory> factoryWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsFactory> list = bmsFactoryService.list(factoryWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "工厂产地", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:factory:query')") |
|||
public R<BmsFactory> getById(@PathVariable("id") String id){ |
|||
BmsFactory bmsFactory = bmsFactoryService.getById(id); |
|||
return R.ok(bmsFactory); |
|||
} |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "工厂产地", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:factory:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsFactory param){ |
|||
param.setCode(null); |
|||
param.setName(null); |
|||
boolean result = bmsFactoryService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "工厂产地", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:factory:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsFactory param){ |
|||
boolean result = bmsFactoryService.save(param); |
|||
bmsRegionService.updateAllFactoryIdsByFactoryId(param.getId(), FactoryIdOperation.Add); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "工厂产地", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:factory:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
boolean result = bmsFactoryService.removeById(id); |
|||
bmsRegionService.updateAllFactoryIdsByFactoryId(id, FactoryIdOperation.Del); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,223 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.Assert; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.bms.common.MasterUserType; |
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserCenterVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserPointVo; |
|||
import com.qs.serve.modules.bms.mapper.BmsMasterUserMapper; |
|||
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserVo; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsMasterUserBo; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.service.BmsMasterUserService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 负责人 |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/masterUser") |
|||
public class BmsMasterUserController { |
|||
|
|||
private BmsChannelService bmsChannelService; |
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private BmsMasterUserService bmsMasterUserService; |
|||
private BmsMasterUserMapper bmsMasterUserMapper; |
|||
private SysUserService sysUserService; |
|||
|
|||
/** |
|||
* 负责人列表(渠道) |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list4Channel") |
|||
public R<List<BmsMasterUserChannelVo>> getList(BmsMasterUserChannelVo userChannel){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserChannelVo> list = bmsMasterUserMapper.selectChannelMasterUserList(userChannel); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人翻页(渠道) |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page4Channel") |
|||
public R<PageVo<BmsMasterUserChannelVo>> getPage(BmsMasterUserChannelVo userChannel){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserChannelVo> list = bmsMasterUserMapper.selectChannelMasterUserList(userChannel); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人列表(网点) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list4Point") |
|||
public R<List<BmsMasterUserPointVo>> list4Point(BmsMasterUserPointVo param){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserPointVo> list = bmsMasterUserMapper.selectPointMasterUserList(param); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人翻页(网点) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page4Point") |
|||
public R<PageVo<BmsMasterUserPointVo>> page4Point(BmsMasterUserPointVo param){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserPointVo> list = bmsMasterUserMapper.selectPointMasterUserList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人列表(成本中心) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list4center") |
|||
public R<List<BmsMasterUserCenterVo>> list4center(BmsMasterUser param){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserCenterVo> list = bmsMasterUserMapper.selectCenterMasterUserList(param); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人翻页(成本中心) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page4center") |
|||
public R<PageVo<BmsMasterUserCenterVo>> page4center(BmsMasterUser param){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserCenterVo> list = bmsMasterUserMapper.selectCenterMasterUserList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "负责人", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:masterUser:query')") |
|||
public R<BmsMasterUser> getById(@PathVariable("id") String id){ |
|||
BmsMasterUser bmsMasterUser = bmsMasterUserService.getById(id); |
|||
SysUser sysUser = sysUserService.getById(bmsMasterUser.getUserId()); |
|||
bmsMasterUser.setUserInfo(sysUser.toSysUserVo()); |
|||
if(bmsMasterUser.getType().equals(MasterUserType.Channel)){ |
|||
BmsChannel channel = bmsChannelService.getById(bmsMasterUser.getTargetId()); |
|||
bmsMasterUser.setObjectInfo(channel); |
|||
}else if(bmsMasterUser.getType().equals(MasterUserType.Point)){ |
|||
BmsChannelPoint point = bmsChannelPointService.getById(bmsMasterUser.getTargetId()); |
|||
bmsMasterUser.setObjectInfo(point); |
|||
} |
|||
return R.ok(bmsMasterUser); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/saveBatch") |
|||
@SysLog(module = SystemModule.BASE, title = "负责人", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:masterUser:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsMasterUserBo param){ |
|||
String type = param.getType(); |
|||
if(!type.equals(MasterUserType.Center) && !type.equals(MasterUserType.Channel) && !type.equals(MasterUserType.Point )){ |
|||
Assert.throwEx("没有对应的"+param.getType()+"类型!"); |
|||
} |
|||
List<BmsMasterUser> masterUsers = new ArrayList<>(); |
|||
for (String userId : param.getUserIds()) { |
|||
for (String targetId : param.getTargetIds()) { |
|||
bmsMasterUserService.removeMgrUser(type,targetId,userId); |
|||
BmsMasterUser masterUser = new BmsMasterUser(); |
|||
masterUser.setType(type); |
|||
masterUser.setTargetId(targetId); |
|||
masterUser.setUserId(userId); |
|||
masterUsers.add(masterUser); |
|||
} |
|||
} |
|||
bmsMasterUserService.saveBatch(masterUsers); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 设置为主要负责人 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@PostMapping("/setMaster/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:regionUser:update')") |
|||
public R<?> updateById(@PathVariable("id")Long id){ |
|||
bmsMasterUserService.setMaster(id); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 取消主要负责人 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@PostMapping("/cancelMaster/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:masterUser:update')") |
|||
public R<?> cancelMaster(@PathVariable("id")Long id){ |
|||
BmsMasterUser regionUser = new BmsMasterUser(); |
|||
regionUser.setId(id); |
|||
regionUser.setMasterFlag(0); |
|||
bmsMasterUserService.updateById(regionUser); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.BASE, title = "负责人", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:masterUser:delete')") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = bmsMasterUserService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,303 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.LimitSubmit; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion2; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsRegionBatchBo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.bms.service.*; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.cache.annotation.Cacheable; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 行政区域 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/bizRegion") |
|||
public class BmsRegion2Controller { |
|||
|
|||
private BmsRegion2Service bmsRegion2Service; |
|||
private BmsSupplierService bmsSupplierService; |
|||
private BmsRuleRegionService bmsRuleRegionService; |
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private BmsRegionUserService bmsRegionUserService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<List<BmsRegion2>> getList(BmsRegion2 param){ |
|||
LambdaQueryWrapper<BmsRegion2> regionWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRegion2> list = bmsRegion2Service.list(regionWrapper); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 树查询(当前负责人) |
|||
* @return |
|||
*/ |
|||
private List<BmsRegionTreeVo> treeByCurrentUser(){ |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
LambdaQueryWrapper<BmsRegionUser> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRegionUser::getType,0); |
|||
lqw.eq(BmsRegionUser::getUserId,userId); |
|||
List<BmsRegionUser> regionUsers = bmsRegionUserService.list(lqw); |
|||
List<String> regionIds = regionUsers.stream().map(BmsRegionUser::getRegionId).collect(Collectors.toList()); |
|||
if(regionIds.size()>0){ |
|||
List<BmsRegion2> regionList = bmsRegion2Service.listByIds(regionIds); |
|||
Map<Integer,List<BmsRegion2>> listMap = regionList.stream().collect(Collectors.groupingBy(BmsRegion2::getLevel)); |
|||
List<BmsRegion2> list1 = listMap.get(1)==null?new ArrayList<>():listMap.get(1); |
|||
List<BmsRegion2> list2 = listMap.get(2)==null?new ArrayList<>():listMap.get(2); |
|||
List<BmsRegion2> list3 = listMap.get(3)==null?new ArrayList<>():listMap.get(3); |
|||
List<BmsRegion2> list4 = listMap.get(3)==null?new ArrayList<>():listMap.get(4); |
|||
if (list4!=null){ |
|||
list4.forEach(obj4->{ |
|||
boolean exist = false; |
|||
for (BmsRegion2 obj3 : list3) { |
|||
if(obj3.getId().equals(obj4.getPid())){ |
|||
List<BmsRegion2> childList = obj3.getChildNodes()==null?new ArrayList<>():obj3.getChildNodes(); |
|||
childList.add(obj4); |
|||
obj3.setChildNodes(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list3.add(obj4); |
|||
} |
|||
}); |
|||
} |
|||
list3.forEach(obj3->{ |
|||
boolean exist = false; |
|||
for (BmsRegion2 obj2 : list2) { |
|||
if(obj2.getId().equals(obj3.getPid())){ |
|||
List<BmsRegion2> childList = obj2.getChildNodes()==null?new ArrayList<>():obj2.getChildNodes(); |
|||
childList.add(obj3); |
|||
obj2.setChildNodes(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list2.add(obj3); |
|||
} |
|||
}); |
|||
list2.forEach(obj2->{ |
|||
boolean exist = false; |
|||
for (BmsRegion2 obj1 : list1) { |
|||
if(obj1.getId().equals(obj2.getPid())){ |
|||
List<BmsRegion2> childList = obj1.getChildNodes()==null?new ArrayList<>():obj1.getChildNodes(); |
|||
childList.add(obj2); |
|||
obj1.setChildNodes(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list1.add(obj2); |
|||
} |
|||
}); |
|||
return toTreeNodeList(list1); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<PageVo<BmsRegion2>> getPage(BmsRegion2 param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsRegion2> regionWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRegion2> list = bmsRegion2Service.list(regionWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param loadByCurrent |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<List<BmsRegionTreeVo>> getTree(Integer listUserFlag,Integer loadByCurrent){ |
|||
if(loadByCurrent!=null&&loadByCurrent.equals(1)){ |
|||
return R.ok(treeByCurrentUser()); |
|||
} |
|||
return R.ok(bmsRegion2Service.getTree(listUserFlag!=null&&listUserFlag.equals(1))); |
|||
} |
|||
|
|||
private List<BmsRegionTreeVo> toTreeNodeList(List<BmsRegion2> list){ |
|||
List<BmsRegionTreeVo> treeVoList = new ArrayList<>(); |
|||
for (BmsRegion2 region2 : list) { |
|||
BmsRegionTreeVo treeNode = CopierUtil.copy(region2,new BmsRegionTreeVo()); |
|||
treeNode.setId(region2.getId()); |
|||
treeNode.setParentId(region2.getPid()); |
|||
treeNode.setSort(0); |
|||
if(CollectionUtil.isNotEmpty(region2.getChildNodes())){ |
|||
List<BmsRegionTreeVo> childList = toTreeNodeList(region2.getChildNodes()); |
|||
for (BmsRegionTreeVo treeVo : childList) { |
|||
treeNode.addChildren(treeVo); |
|||
} |
|||
} |
|||
treeVoList.add(treeNode); |
|||
} |
|||
return treeVoList; |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<BmsRegion2> getById(@PathVariable("id") String id){ |
|||
BmsRegion2 msRegion2 = bmsRegion2Service.getById(id); |
|||
if(msRegion2.getPid()!=null&&!msRegion2.getPid().equals("0")){ |
|||
BmsRegion2 bmsRegion2 = bmsRegion2Service.getById(msRegion2.getPid()); |
|||
msRegion2.setParentInfo(bmsRegion2); |
|||
} |
|||
return R.ok(msRegion2); |
|||
} |
|||
|
|||
/** |
|||
* 更新(只允许改名称) |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:region:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ |
|||
BmsRegion2 param = new BmsRegion2(); |
|||
param.setId(regionBo.getId()); |
|||
param.setName(regionBo.getName()); |
|||
boolean result = bmsRegion2Service.updateBmsRegion2ById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 更新工厂 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateFactory") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:region:update')") |
|||
public R<?> updateFactory(@RequestBody BmsRegion2 regionBo){ |
|||
BmsRegion2 param = new BmsRegion2(); |
|||
param.setId(regionBo.getId()); |
|||
boolean result = bmsRegion2Service.updateBmsRegion2ById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增区域档案 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:region:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ |
|||
BmsRegion2 param = CopierUtil.copy(regionBo,new BmsRegion2()); |
|||
if(param.getId()==null){ |
|||
param.setId(IdUtil.getSnowFlakeId()+""); |
|||
} |
|||
boolean result = bmsRegion2Service.saveBmsRegion2(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 【dev】测试接口,更新祖级数据 |
|||
* @return |
|||
*/ |
|||
@LimitSubmit(interval = 15000) |
|||
@GetMapping("/updateLevelDev") |
|||
public R<?> editBatch(){ |
|||
bmsRegion2Service.flushAllLevel(true); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* (批量)编辑(更新,只允许改名称) |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/editBatch") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:region:insert')") |
|||
public R<?> editBatch(@RequestBody @Valid BmsRegionBatchBo regionBo){ |
|||
ValidateTools.valid(regionBo.getRegionList()); |
|||
for (BmsRegionBatchBo.BmsRegionBo BmsRegion2Bo : regionBo.getRegionList()) { |
|||
BmsRegion2 dbRegion = bmsRegion2Service.getByCode(BmsRegion2Bo.getCode()); |
|||
if(dbRegion==null){ |
|||
BmsRegion2 region = CopierUtil.copy(BmsRegion2Bo,new BmsRegion2()); |
|||
bmsRegion2Service.save(region); |
|||
}else { |
|||
BmsRegion2 param = new BmsRegion2(); |
|||
param.setId(BmsRegion2Bo.getId()); |
|||
param.setName(BmsRegion2Bo.getName()); |
|||
bmsRegion2Service.updateById(param); |
|||
} |
|||
} |
|||
bmsRegion2Service.flushAllLevel(true); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除区域档案 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:region:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
if(bmsRegion2Service.listChild(id).size()>0){ |
|||
return R.error("含有子区域无法删除"); |
|||
} |
|||
//如果有供应商则不允许删除
|
|||
if(bmsSupplierService.listByRegion2Id(id).size()>0){ |
|||
return R.error("地区含有供应商无法删除"); |
|||
} |
|||
if(bmsChannelPointService.listBySaleRegionId(id).size()>0){ |
|||
return R.error("地区含有网点无法删除"); |
|||
} |
|||
//删除商品限制
|
|||
bmsRuleRegionService.removeByRegionId(id); |
|||
boolean result = bmsRegion2Service.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,311 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.LimitSubmit; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.entity.*; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsRegionBatchBo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.bms.service.*; |
|||
import com.qs.serve.modules.his.service.HisUserSupplierService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.cache.annotation.Cacheable; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 销售区域 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/region") |
|||
public class BmsRegionController { |
|||
|
|||
private BmsRegionService bmsRegionService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
private BmsRuleRegionService bmsRuleRegionService; |
|||
private BmsFactoryService bmsFactoryService; |
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private BmsRegionUserService bmsRegionUserService; |
|||
private HisUserSupplierService hisUserSupplierService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<List<BmsRegion>> getList(BmsRegion param){ |
|||
LambdaQueryWrapper<BmsRegion> regionWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRegion> list = bmsRegionService.list(regionWrapper); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<PageVo<BmsRegion>> getPage(BmsRegion param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsRegion> regionWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRegion> list = bmsRegionService.list(regionWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param listUserFlag |
|||
* @param loadByCurrent 值=1,过滤当前用户负责数据 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<List<BmsRegionTreeVo>> getTree(Integer listUserFlag,Integer loadByCurrent){ |
|||
if(loadByCurrent!=null&&loadByCurrent.equals(1)){ |
|||
return R.ok(treeByCurrentUser()); |
|||
} |
|||
return R.ok(bmsRegionService.getTree(listUserFlag!=null&&listUserFlag.equals(1))); |
|||
} |
|||
|
|||
|
|||
public List<BmsRegionTreeVo> treeByCurrentUser(){ |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
LambdaQueryWrapper<BmsRegionUser> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRegionUser::getType,0); |
|||
lqw.eq(BmsRegionUser::getUserId,userId); |
|||
List<BmsRegionUser> regionUsers = bmsRegionUserService.list(lqw); |
|||
List<String> regionIds = regionUsers.stream().map(BmsRegionUser::getRegionId).collect(Collectors.toList()); |
|||
if(regionIds.size()>0){ |
|||
List<BmsRegion> regionList = bmsRegionService.listByIds(regionIds); |
|||
Map<Integer,List<BmsRegion>> listMap = regionList.stream().collect(Collectors.groupingBy(BmsRegion::getLevel)); |
|||
List<BmsRegion> list1 = listMap.get(1)==null?new ArrayList<>():listMap.get(1); |
|||
List<BmsRegion> list2 = listMap.get(2)==null?new ArrayList<>():listMap.get(2); |
|||
List<BmsRegion> list3 = listMap.get(3)==null?new ArrayList<>():listMap.get(3); |
|||
list3.forEach(obj3->{ |
|||
boolean exist = false; |
|||
for (BmsRegion obj2 : list2) { |
|||
if(obj2.getId().equals(obj3.getPid())){ |
|||
List<BmsRegion> childList = obj2.getChildNodes()==null?new ArrayList<>():obj2.getChildNodes(); |
|||
childList.add(obj3); |
|||
obj2.setChildNodes(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list2.add(obj3); |
|||
} |
|||
}); |
|||
list2.forEach(obj2->{ |
|||
boolean exist = false; |
|||
for (BmsRegion obj1 : list1) { |
|||
if(obj1.getId().equals(obj2.getPid())){ |
|||
List<BmsRegion> childList = obj1.getChildNodes()==null?new ArrayList<>():obj1.getChildNodes(); |
|||
childList.add(obj2); |
|||
obj1.setChildNodes(childList); |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(!exist){ |
|||
list1.add(obj2); |
|||
} |
|||
}); |
|||
|
|||
return toTreeNodeList(list1); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
private List<BmsRegionTreeVo> toTreeNodeList(List<BmsRegion> list){ |
|||
List<BmsRegionTreeVo> treeVoList = new ArrayList<>(); |
|||
for (BmsRegion region : list) { |
|||
BmsRegionTreeVo treeNode = CopierUtil.copy(region,new BmsRegionTreeVo()); |
|||
treeNode.setId(region.getId()); |
|||
treeNode.setParentId(region.getPid()); |
|||
treeNode.setSort(0); |
|||
if(CollectionUtil.isNotEmpty(region.getChildNodes())){ |
|||
List<BmsRegionTreeVo> childList = toTreeNodeList(region.getChildNodes()); |
|||
for (BmsRegionTreeVo treeVo : childList) { |
|||
treeNode.addChildren(treeVo); |
|||
} |
|||
} |
|||
treeVoList.add(treeNode); |
|||
} |
|||
return treeVoList; |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:region:query')") |
|||
public R<BmsRegion> getById(@PathVariable("id") String id){ |
|||
BmsRegion bmsRegion = bmsRegionService.getById(id); |
|||
if(StringUtils.hasText(bmsRegion.getPid())&&bmsRegion.getPid().equals("0")){ |
|||
bmsRegion.setPid(null); |
|||
} |
|||
if(bmsRegion.getPid()!=null){ |
|||
BmsRegion bmsRegion2 = bmsRegionService.getById(bmsRegion.getPid()); |
|||
bmsRegion.setParentInfo(bmsRegion2); |
|||
} |
|||
List<BmsFactory> defaultFactories = bmsFactoryService.list(); |
|||
if(CollectionUtil.isNotEmpty(bmsRegion.getFactoryIds())){ |
|||
List<BmsFactory> factories = new ArrayList<>(); |
|||
for (String factoryId : bmsRegion.getFactoryIds()) { |
|||
for (BmsFactory factory : defaultFactories) { |
|||
if(factory.getId().equals(factoryId)){ |
|||
factories.add(factory); |
|||
} |
|||
} |
|||
} |
|||
bmsRegion.setFactoryInfos(factories); |
|||
}else { |
|||
bmsRegion.setFactoryInfos(defaultFactories); |
|||
} |
|||
return R.ok(bmsRegion); |
|||
} |
|||
|
|||
/** |
|||
* 更新(只允许改名称) |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:region:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ |
|||
BmsRegion param = new BmsRegion(); |
|||
param.setId(regionBo.getId()); |
|||
param.setName(regionBo.getName()); |
|||
boolean result = bmsRegionService.updateBmsRegionById(param); |
|||
// bmsRegionService.flushLevel(param);
|
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 更新工厂 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateFactory") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:region:update')") |
|||
public R<?> updateFactory(@RequestBody BmsRegion regionBo){ |
|||
BmsRegion param = new BmsRegion(); |
|||
param.setId(regionBo.getId()); |
|||
param.setFactoryIds(regionBo.getFactoryIds()); |
|||
boolean result = bmsRegionService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增区域档案 |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:region:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsRegionBatchBo.BmsRegionBo regionBo){ |
|||
BmsRegion param = CopierUtil.copy(regionBo,new BmsRegion()); |
|||
if(param.getId()==null){ |
|||
param.setId(IdUtil.getSnowFlakeId()+""); |
|||
} |
|||
boolean result = bmsRegionService.saveBmsRegion(param); |
|||
// bmsRegionService.flushLevel(param);
|
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* (批量)编辑(更新,只允许改名称) |
|||
* @param regionBo |
|||
* @return |
|||
*/ |
|||
@PostMapping("/editBatch") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:region:insert')") |
|||
public R<?> editBatch(@RequestBody @Valid BmsRegionBatchBo regionBo){ |
|||
ValidateTools.valid(regionBo.getRegionList()); |
|||
for (BmsRegionBatchBo.BmsRegionBo bmsRegionBo : regionBo.getRegionList()) { |
|||
BmsRegion dbRegion = bmsRegionService.getByCode(bmsRegionBo.getCode()); |
|||
if(dbRegion==null){ |
|||
BmsRegion region = CopierUtil.copy(bmsRegionBo,new BmsRegion()); |
|||
bmsRegionService.save(region); |
|||
}else { |
|||
BmsRegion param = new BmsRegion(); |
|||
param.setId(bmsRegionBo.getId()); |
|||
param.setName(bmsRegionBo.getName()); |
|||
bmsRegionService.updateById(param); |
|||
} |
|||
} |
|||
bmsRegionService.flushAllLevel(false); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 【dev】测试接口,更新祖级数据 |
|||
* @return |
|||
*/ |
|||
@LimitSubmit(interval = 15000) |
|||
@GetMapping("/updateLevelDev") |
|||
public R<?> editBatch(){ |
|||
bmsRegionService.flushAllLevel(true); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除区域档案 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域档案", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:region:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
//删除区域档案
|
|||
if(bmsRegionService.listChild(id).size()>0){ |
|||
return R.error("含有子区域无法删除"); |
|||
} |
|||
//如果有供应商则不允许删除
|
|||
if(bmsSupplierService.listByRegionId(id).size()>0){ |
|||
return R.error("地区含有供应商无法删除"); |
|||
} |
|||
if(bmsChannelPointService.listByBizRegionId(id).size()>0){ |
|||
return R.error("地区含有网点无法删除"); |
|||
} |
|||
//删除商品限制
|
|||
bmsRuleRegionService.removeByRegionId(id); |
|||
boolean result = bmsRegionService.removeById(id); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,182 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CollectionUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion2; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsRegionUserBo; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsRegionUserSaveBo; |
|||
import com.qs.serve.modules.bms.service.BmsRegion2Service; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
import com.qs.serve.modules.bms.service.BmsRegionUserService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 区域负责人 |
|||
* @author YenHex |
|||
* @since 2022-11-02 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/regionUser") |
|||
public class BmsRegionUserController { |
|||
|
|||
private BmsRegionUserService bmsRegionUserService; |
|||
private BmsRegion2Service bmsRegion2Service; |
|||
private BmsRegionService bmsRegionService; |
|||
private SysUserService sysUserService; |
|||
|
|||
public R<?> commentRegionList(){ |
|||
|
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
@PreAuthorize("hasRole('bms:regionUser:query')") |
|||
public R<List<BmsRegionUser>> getPage(BmsRegionUserBo param){ |
|||
BmsRegionUser regionUser = CopierUtil.copy(param,new BmsRegionUser()); |
|||
LambdaQueryWrapper<BmsRegionUser> regionUserWrapper = new LambdaQueryWrapper<>(regionUser); |
|||
List<BmsRegionUser> list = bmsRegionUserService.list(regionUserWrapper); |
|||
if(list.size()<1){ |
|||
return R.ok(new ArrayList<>()); |
|||
} |
|||
List<String> userIds = list.stream().map(BmsRegionUser::getUserId).collect(Collectors.toList()); |
|||
List<SysUser> sysUsers = sysUserService.listByIds(userIds); |
|||
for (BmsRegionUser bmsRegionUser : list) { |
|||
for (SysUser sysUser : sysUsers) { |
|||
if(bmsRegionUser.getUserId().equals(sysUser.getId())){ |
|||
bmsRegionUser.setUserName(sysUser.getName()); |
|||
bmsRegionUser.setUserCode(sysUser.getCode()); |
|||
} |
|||
} |
|||
} |
|||
|
|||
Map<Integer,List<BmsRegionUser>> listMap = list.stream().collect(Collectors.groupingBy(BmsRegionUser::getType)); |
|||
List<BmsRegionUser> list1 = listMap.get(0); |
|||
if(CollectionUtil.isNotEmpty(list1)){ |
|||
List<String> regionIds = list1.stream().map(BmsRegionUser::getRegionId).collect(Collectors.toList()); |
|||
List<BmsRegion> regionList = bmsRegionService.listByIds(regionIds); |
|||
for (BmsRegion region : regionList) { |
|||
for (BmsRegionUser bmsRegionUser : list) { |
|||
if(bmsRegionUser.getRegionId().equals(region.getId())){ |
|||
bmsRegionUser.setRegionCode(region.getCode()); |
|||
bmsRegionUser.setRegionName(region.getName()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
List<BmsRegionUser> list2 = listMap.get(1); |
|||
if(CollectionUtil.isNotEmpty(list2)){ |
|||
List<String> regionIds = list2.stream().map(BmsRegionUser::getRegionId).collect(Collectors.toList()); |
|||
List<BmsRegion2> regionList = bmsRegion2Service.listByIds(regionIds); |
|||
for (BmsRegion2 region : regionList) { |
|||
for (BmsRegionUser bmsRegionUser : list) { |
|||
if(bmsRegionUser.getRegionId().equals(region.getId())){ |
|||
bmsRegionUser.setRegionCode(region.getCode()); |
|||
bmsRegionUser.setRegionName(region.getName()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 批量保存 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:regionUser:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsRegionUserSaveBo param){ |
|||
Integer type = param.getType(); |
|||
List<BmsRegionUser> bmsRegionUsers = new ArrayList<>(); |
|||
for (String regionId : param.getRegionIds()) { |
|||
for (String userId : param.getUserIds()) { |
|||
BmsRegionUser regionUser = bmsRegionUserService.getByParam(type,regionId,userId); |
|||
if(regionUser==null){ |
|||
regionUser = new BmsRegionUser(); |
|||
regionUser.setType(type); |
|||
regionUser.setRegionId(regionId); |
|||
regionUser.setUserId(userId); |
|||
bmsRegionUsers.add(regionUser); |
|||
} |
|||
} |
|||
} |
|||
bmsRegionUserService.saveBatch(bmsRegionUsers); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 设置为主要负责人 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@PostMapping("/setMaster/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:regionUser:update')") |
|||
public R<?> updateById(@PathVariable("id")Long id){ |
|||
bmsRegionUserService.setMaster(id); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 取消主要负责人 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@PostMapping("/cancelMaster/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:regionUser:update')") |
|||
public R<?> cancelMaster(@PathVariable("id")Long id){ |
|||
BmsRegionUser regionUser = new BmsRegionUser(); |
|||
regionUser.setId(id); |
|||
regionUser.setMasterFlag(0); |
|||
bmsRegionUserService.updateById(regionUser); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:regionUser:delete')") |
|||
public R<?> deleteById(@PathVariable String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
bmsRegionUserService.removeByIds(idsLong); |
|||
return R.ok(); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,250 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CollectionUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.BmsRuleRegion; |
|||
import com.qs.serve.modules.bms.entity.BmsRuleSku; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsRuleBo; |
|||
import com.qs.serve.modules.bms.service.*; |
|||
import com.qs.serve.modules.goods.entity.GoodsSku; |
|||
import com.qs.serve.modules.goods.entity.vo.GoodSkuVo; |
|||
import com.qs.serve.modules.goods.service.GoodsSkuService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsRule; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 规则 |
|||
* @author YenHex |
|||
* @since 2022-10-19 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/rule") |
|||
public class BmsRuleController { |
|||
|
|||
private BmsRuleService bmsRuleService; |
|||
private BmsRuleRegionService bmsRuleRegionService; |
|||
private BmsRuleSkuService bmsRuleSkuService; |
|||
private BmsRegionService bmsRegionService; |
|||
private GoodsSkuService goodsSkuService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:rule:query')") |
|||
public R<PageVo<BmsRule>> getPage(BmsRule param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsRule> ruleWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsRule> list = bmsRuleService.list(ruleWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:rule:query')") |
|||
public R<BmsRule> getById(@PathVariable("id") String id){ |
|||
BmsRule bmsRule = bmsRuleService.getById(id); |
|||
return R.ok(bmsRule); |
|||
} |
|||
|
|||
/** |
|||
* 规则商品列表 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/listRuleProducts/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:rule:query')") |
|||
public R<PageVo<GoodSkuVo>> listRuleProducts(@PathVariable("id") String id){ |
|||
PageUtil.startPage(); |
|||
List<BmsRuleSku> ruleSkus = bmsRuleSkuService.listSkuIdsByRuleId(Long.parseLong(id)); |
|||
if(CollectionUtil.isNotEmpty(ruleSkus)){ |
|||
GoodsSku param = new GoodsSku(); |
|||
List<Long> skuIds = ruleSkus.stream().map(BmsRuleSku::getSkuId).collect(Collectors.toList()); |
|||
param.setSelectSkuIds(skuIds); |
|||
List<GoodSkuVo> skuVos = goodsSkuService.selectSkuVo(param); |
|||
R.byPageHelperList(ruleSkus,skuVos); |
|||
} |
|||
return R.byEmptyList(); |
|||
} |
|||
|
|||
/** |
|||
* 规则地区列表 |
|||
* @param ruleId |
|||
* @param type 0只售 1禁售 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/listRuleRegion") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:rule:query')") |
|||
public R<PageVo<BmsRegion>> listRuleProducts(@NotNull Long ruleId, |
|||
@NotNull Integer type){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsRuleRegion> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleRegion::getRuleId,ruleId); |
|||
lqw.eq(BmsRuleRegion::getTypeFlag,type); |
|||
List<BmsRuleRegion> ruleRegions = bmsRuleRegionService.list(lqw); |
|||
if(CollectionUtil.isNotEmpty(ruleRegions)){ |
|||
List<String> regionIds = ruleRegions.stream().map(BmsRuleRegion::getRegionId).collect(Collectors.toList()); |
|||
List<BmsRegion> regionList = bmsRegionService.listByIds(regionIds); |
|||
return R.byPageHelperList(regionIds,regionList); |
|||
} |
|||
return R.byEmptyList(); |
|||
} |
|||
|
|||
/** |
|||
* 编辑规则 |
|||
* @param bmsRule |
|||
* @return |
|||
*/ |
|||
@PostMapping("/saveOrUpdate") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:rule:update')") |
|||
public R<?> save(@RequestBody @Valid BmsRule bmsRule){ |
|||
bmsRuleService.saveOrUpdate(bmsRule); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 规则 添加项 |
|||
* @param bmsRule |
|||
* @return |
|||
*/ |
|||
@PostMapping("/addItem") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:rule:update')") |
|||
public R<?> addItem(@RequestBody @Valid BmsRuleBo bmsRule){ |
|||
Long ruleId = bmsRule.getId(); |
|||
List<Long> skuIds = bmsRule.getSkuIds(); |
|||
List<String> banSaleRegionIds = bmsRule.getBanSaleRegionIds(); |
|||
List<String> onlySaleRegionIds = bmsRule.getOnlySaleRegionIds(); |
|||
if(CollectionUtil.isNotEmpty(bmsRule.getSkuIds())){ |
|||
List<BmsRuleSku> ruleSkuList = new ArrayList<>(); |
|||
LambdaQueryWrapper<BmsRuleSku> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleSku::getRuleId,ruleId); |
|||
lqw.in(BmsRuleSku::getSkuId,skuIds); |
|||
bmsRuleSkuService.remove(lqw); |
|||
GoodsSku param = new GoodsSku(); |
|||
param.setSelectSkuIds(skuIds); |
|||
List<GoodSkuVo> goodSkuVos = goodsSkuService.selectSkuVo(param); |
|||
for (GoodSkuVo goodSkuVo : goodSkuVos) { |
|||
BmsRuleSku ruleSku = new BmsRuleSku(); |
|||
ruleSku.setRuleId(ruleId); |
|||
ruleSku.setSpuId(goodSkuVo.getSpuId()); |
|||
ruleSku.setSkuId(goodSkuVo.getId()); |
|||
ruleSkuList.add(ruleSku); |
|||
} |
|||
bmsRuleSkuService.saveBatch(ruleSkuList); |
|||
} |
|||
//去重
|
|||
if(CollectionUtil.isNotEmpty(banSaleRegionIds)&&CollectionUtil.isNotEmpty(onlySaleRegionIds)){ |
|||
onlySaleRegionIds = onlySaleRegionIds.stream().filter(onlySaleRegionId-> |
|||
banSaleRegionIds.stream().noneMatch(banId->banId.equals(onlySaleRegionId)) |
|||
).collect(Collectors.toList()); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(banSaleRegionIds)){ |
|||
LambdaQueryWrapper<BmsRuleRegion> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleRegion::getRuleId,ruleId); |
|||
lqw.in(BmsRuleRegion::getRegionId,banSaleRegionIds); |
|||
bmsRuleRegionService.remove(lqw); |
|||
List<BmsRuleRegion> ruleRegions = banSaleRegionIds.stream().map(regionId->{ |
|||
BmsRuleRegion ruleRegion = new BmsRuleRegion(); |
|||
ruleRegion.setRegionId(regionId); |
|||
ruleRegion.setRuleId(ruleId); |
|||
ruleRegion.setTypeFlag(1); |
|||
return ruleRegion; |
|||
}).collect(Collectors.toList()); |
|||
bmsRuleRegionService.saveBatch(ruleRegions); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(onlySaleRegionIds)){ |
|||
LambdaQueryWrapper<BmsRuleRegion> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleRegion::getRuleId,ruleId); |
|||
lqw.in(BmsRuleRegion::getRegionId,onlySaleRegionIds); |
|||
bmsRuleRegionService.remove(lqw); |
|||
List<BmsRuleRegion> ruleRegions = onlySaleRegionIds.stream().map(regionId->{ |
|||
BmsRuleRegion ruleRegion = new BmsRuleRegion(); |
|||
ruleRegion.setRegionId(regionId); |
|||
ruleRegion.setRuleId(ruleId); |
|||
ruleRegion.setTypeFlag(0); |
|||
return ruleRegion; |
|||
}).collect(Collectors.toList()); |
|||
bmsRuleRegionService.saveBatch(ruleRegions); |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 规则 移除项 |
|||
* @param bmsRule |
|||
* @return |
|||
*/ |
|||
@PostMapping("/removeItem") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:rule:update')") |
|||
public R<?> removeItem(@RequestBody @Valid BmsRuleBo bmsRule){ |
|||
Long ruleId = bmsRule.getId(); |
|||
List<Long> skuIds = bmsRule.getSkuIds(); |
|||
List<String> banSaleRegionIds = bmsRule.getBanSaleRegionIds(); |
|||
List<String> onlySaleRegionIds = bmsRule.getOnlySaleRegionIds(); |
|||
if(CollectionUtil.isNotEmpty(bmsRule.getSkuIds())){ |
|||
LambdaQueryWrapper<BmsRuleSku> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleSku::getRuleId,ruleId); |
|||
lqw.in(BmsRuleSku::getSkuId,skuIds); |
|||
bmsRuleSkuService.remove(lqw); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(banSaleRegionIds)){ |
|||
LambdaQueryWrapper<BmsRuleRegion> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleRegion::getRuleId,ruleId); |
|||
lqw.in(BmsRuleRegion::getRegionId,banSaleRegionIds); |
|||
bmsRuleRegionService.remove(lqw); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(onlySaleRegionIds)){ |
|||
LambdaQueryWrapper<BmsRuleRegion> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsRuleRegion::getRuleId,ruleId); |
|||
lqw.in(BmsRuleRegion::getRegionId,onlySaleRegionIds); |
|||
bmsRuleRegionService.remove(lqw); |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除规则 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "规则", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:rule:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
boolean result = bmsRuleService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,119 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSkuSupplierBo; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSkuSupplierBo2; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsSkuSupplierVo; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import com.qs.serve.modules.goods.entity.GoodsSku; |
|||
import com.qs.serve.modules.goods.service.GoodsSkuService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSkuSupplier; |
|||
import com.qs.serve.modules.bms.service.BmsSkuSupplierService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 指定客户的商品规则 |
|||
* @author YenHex |
|||
* @since 2022-10-17 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/skuSupplier") |
|||
public class BmsSkuSupplierController { |
|||
|
|||
private BmsSkuSupplierService bmsSkuSupplierService; |
|||
private GoodsSkuService goodsSkuService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @apiNote skuId=0 标识是商品规则 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:skuSupplier:query')") |
|||
public R<PageVo<BmsSkuSupplierVo>> getPage(BmsSkuSupplierVo param){ |
|||
PageUtil.startPage(); |
|||
List<BmsSkuSupplierVo> list = bmsSkuSupplierService.selectList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 客户指定SKU(优先级最高) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/update4Sku") |
|||
@SysLog(module = SystemModule.BASE, title = "sku供应商关联", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:skuSupplier:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSkuSupplierBo param){ |
|||
LambdaQueryWrapper<BmsSkuSupplier> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSkuSupplier::getSupplierId,param.getSupplierId()); |
|||
lqw.eq(BmsSkuSupplier::getSkuId,param.getSkuId()); |
|||
BmsSkuSupplier skuSupplier = bmsSkuSupplierService.getOne(lqw,false); |
|||
if(skuSupplier==null){ |
|||
GoodsSku goodsSku = goodsSkuService.getById(param.getSkuId()); |
|||
skuSupplier = CopierUtil.copy(param,new BmsSkuSupplier()); |
|||
skuSupplier.setSpuId(goodsSku.getSpuId()); |
|||
bmsSkuSupplierService.save(skuSupplier); |
|||
}else { |
|||
skuSupplier.setBanStatus(param.getBanStatus()); |
|||
bmsSkuSupplierService.updateById(skuSupplier); |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 客户指定SPU(优先级级比区域设置高) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/update4Spu") |
|||
@SysLog(module = SystemModule.BASE, title = "sku供应商关联", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:skuSupplier:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSkuSupplierBo2 param){ |
|||
LambdaQueryWrapper<BmsSkuSupplier> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSkuSupplier::getSupplierId,param.getSupplierId()); |
|||
lqw.eq(BmsSkuSupplier::getSpuId,param.getSpuId()); |
|||
lqw.eq(BmsSkuSupplier::getSkuId,0); |
|||
BmsSkuSupplier skuSupplier = bmsSkuSupplierService.getOne(lqw,false); |
|||
if(skuSupplier==null){ |
|||
skuSupplier = CopierUtil.copy(param,new BmsSkuSupplier()); |
|||
skuSupplier.setSkuId(0L); |
|||
bmsSkuSupplierService.save(skuSupplier); |
|||
}else { |
|||
skuSupplier.setBanStatus(param.getBanStatus()); |
|||
bmsSkuSupplierService.updateById(skuSupplier); |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @return |
|||
*/ |
|||
@PostMapping("/deleteById") |
|||
@SysLog(module = SystemModule.BASE, title = "sku供应商关联", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:skuSupplier:delete')") |
|||
public R<?> updateById(@PathVariable("id") Long id){ |
|||
bmsSkuSupplierService.removeById(id); |
|||
return R.ok(); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,150 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.TreeUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsCostCenter; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsCostCenterBo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsSubjectTreeVo; |
|||
import com.qs.serve.modules.tbs.entity.TbsActivitySubject; |
|||
import com.qs.serve.modules.tbs.service.TbsActivitySubjectService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSubject; |
|||
import com.qs.serve.modules.bms.service.BmsSubjectService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 科目 |
|||
* @author YenHex |
|||
* @since 2022-11-07 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/subject") |
|||
public class BmsSubjectController { |
|||
|
|||
private BmsSubjectService bmsSubjectService; |
|||
private TbsActivitySubjectService activitySubjectService; |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:subject:query')") |
|||
public R<List<BmsSubjectTreeVo>> getPage(BmsSubject param){ |
|||
LambdaQueryWrapper<BmsSubject> subjectWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSubject> list = bmsSubjectService.list(subjectWrapper); |
|||
List<BmsSubjectTreeVo> treeVoList = list.stream().map(subject->{ |
|||
BmsSubjectTreeVo treeNode = CopierUtil.copy(subject,new BmsSubjectTreeVo()); |
|||
treeNode.setId(subject.getId().toString()); |
|||
treeNode.setParentId(subject.getPid().toString()); |
|||
treeNode.setSort(0); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
return R.ok(TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING)); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:subject:query')") |
|||
public R<BmsSubject> getById(@PathVariable("id") String id){ |
|||
BmsSubject bmsSubject = bmsSubjectService.getById(id); |
|||
if(bmsSubject.getPid()!=null && bmsSubject.getPid()!=0L){ |
|||
BmsSubject par = bmsSubjectService.getById(id); |
|||
if(par!=null){ |
|||
bmsSubject.setParName(par.getSubjectName()); |
|||
} |
|||
} |
|||
return R.ok(bmsSubject); |
|||
} |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:subject:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSubject param){ |
|||
commonEdit(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:subject:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSubject param){ |
|||
commonEdit(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
private void commonEdit(BmsSubject subject){ |
|||
if(subject.getId()==null){ |
|||
bmsSubjectService.save(subject); |
|||
} |
|||
if(subject.getPid()==null||subject.getPid().equals(0L)){ |
|||
subject.setPid(0L); |
|||
subject.setLevel(1); |
|||
subject.setPathNames(subject.getSubjectName()); |
|||
bmsSubjectService.updateById(subject); |
|||
}else { |
|||
BmsSubject parent = bmsSubjectService.getById(subject.getPid()); |
|||
BmsSubject ori = bmsSubjectService.getById(subject.getId()); |
|||
subject.setLevel(parent.getLevel()+1); |
|||
subject.setPathNames(parent.getPathNames()+"_"+subject.getSubjectName()); |
|||
bmsSubjectService.updateById(subject); |
|||
if(!subject.getSubjectName().equals(ori.getSubjectName())) { |
|||
bmsSubjectService.updatePathNameByParent(subject); |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:subject:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
LambdaQueryWrapper<TbsActivitySubject> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(TbsActivitySubject::getSubjectId,id); |
|||
if(activitySubjectService.count(lqw)>0){ |
|||
return R.error("活动含当前的科目,删除失败"); |
|||
} |
|||
boolean result = bmsSubjectService.removeSelfAndChildById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,145 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSupplierAddress; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierAddressService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 客户收货地址 |
|||
* @author YenHex |
|||
* @since 2022-10-12 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplierAddress") |
|||
public class BmsSupplierAddressController { |
|||
|
|||
private BmsSupplierAddressService bmsSupplierAddressService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:supplierAddress:query')") |
|||
public R<PageVo<BmsSupplierAddress>> getPage(BmsSupplierAddress param){ |
|||
PageUtil.startPage(); |
|||
List<BmsSupplierAddress> list = bmsSupplierAddressService.selectBmsSupplierAddressList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:supplierAddress:query')") |
|||
public R<BmsSupplierAddress> getById(@PathVariable("id") String id){ |
|||
BmsSupplierAddress bmsSupplierAddress = bmsSupplierAddressService.getById(id); |
|||
BmsSupplier supplier = bmsSupplierService.getById(bmsSupplierAddress.getSupplierId()); |
|||
bmsSupplierAddress.setSupplierName(supplier.getName()); |
|||
return R.ok(bmsSupplierAddress); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:supplierAddress:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplierAddress param){ |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getDefault(param.getSupplierId()); |
|||
if(supplierAddress==null){ |
|||
param.setDefaultFlag(1); |
|||
}else { |
|||
param.setDefaultFlag(0); |
|||
} |
|||
boolean result = bmsSupplierAddressService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplierAddress:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSupplierAddress param){ |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getDefault(param.getSupplierId()); |
|||
if(supplierAddress==null){ |
|||
param.setDefaultFlag(1); |
|||
}else { |
|||
param.setDefaultFlag(0); |
|||
} |
|||
boolean result = bmsSupplierAddressService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 设置默认的地址 |
|||
* @param id 地址ID |
|||
* @return |
|||
*/ |
|||
@PostMapping("/setDefault/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplierAddress:insert')") |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public R<?> setDefault(@PathVariable("id") Long id){ |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getById(id); |
|||
List<BmsSupplierAddress> list = bmsSupplierAddressService.listBySupplierId(supplierAddress.getSupplierId()); |
|||
//设置其它
|
|||
for (BmsSupplierAddress address : list) { |
|||
if(!address.getId().equals(id)){ |
|||
address.setDefaultFlag(0); |
|||
bmsSupplierAddressService.updateById(address); |
|||
} |
|||
} |
|||
//设置默认
|
|||
supplierAddress.setDefaultFlag(1); |
|||
bmsSupplierAddressService.updateById(supplierAddress); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:supplierAddress:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
boolean result = bmsSupplierAddressService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,111 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierAddress; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSupplierBand; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierBandService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 客户银行信息 |
|||
* @author YenHex |
|||
* @since 2022-10-12 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplierBand") |
|||
public class BmsSupplierBandController { |
|||
|
|||
private BmsSupplierBandService bmsSupplierBandService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:supplierBand:query')") |
|||
public R<PageVo<BmsSupplierBand>> getPage(BmsSupplierBand param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsSupplierBand> supplierBandWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSupplierBand> list = bmsSupplierBandService.list(supplierBandWrapper); |
|||
for (BmsSupplierBand supplierBand : list) { |
|||
BmsSupplier supplier = bmsSupplierService.getById(supplierBand.getSupplierId()); |
|||
supplierBand.setSupplierName(supplier.getName()); |
|||
} |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:supplierBand:query')") |
|||
public R<BmsSupplierBand> getById(@PathVariable("id") String id){ |
|||
BmsSupplierBand bmsSupplierBand = bmsSupplierBandService.getById(id); |
|||
BmsSupplier supplier = bmsSupplierService.getById(bmsSupplierBand.getSupplierId()); |
|||
bmsSupplierBand.setSupplierName(supplier.getName()); |
|||
return R.ok(bmsSupplierBand); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:supplierBand:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplierBand param){ |
|||
boolean result = bmsSupplierBandService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplierBand:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSupplierBand param){ |
|||
boolean result = bmsSupplierBandService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商地址", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:supplierBand:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
boolean result = bmsSupplierBandService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,137 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CollectionUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSupplierChannelBo; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSupplierChannel; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierChannelService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 客户渠道关系 |
|||
* @author YenHex |
|||
* @since 2022-11-03 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplierChannel") |
|||
public class BmsSupplierChannelController { |
|||
|
|||
private BmsSupplierChannelService bmsSupplierChannelService; |
|||
private BmsChannelService bmsChannelService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('bms:supplierChannel:query')") |
|||
public R<PageVo<BmsSupplierChannel>> getPage(BmsSupplierChannel param){ |
|||
PageUtil.startPage(); |
|||
List<BmsSupplierChannel> list = bmsSupplierChannelService.selectSupplierChannelList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "客户渠道关系", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:supplierChannel:query')") |
|||
public R<BmsSupplierChannel> getById(@PathVariable("id") String id){ |
|||
BmsSupplierChannel bmsSupplierChannel = bmsSupplierChannelService.getById(id); |
|||
BmsChannel channel = bmsChannelService.getById(bmsSupplierChannel.getChannelId()); |
|||
bmsSupplierChannel.setChannelName(channel.getChannelName()); |
|||
BmsSupplier supplier = bmsSupplierService.getById(bmsSupplierChannel.getSupplierId().toString()); |
|||
bmsSupplierChannel.setSupplierCode(supplier.getCode()); |
|||
bmsSupplierChannel.setSupplierName(supplier.getName()); |
|||
return R.ok(bmsSupplierChannel); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "客户渠道关系", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:supplierChannel:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplierChannel param){ |
|||
boolean result = bmsSupplierChannelService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "客户渠道关系", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplierChannel:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSupplierChannelBo param){ |
|||
for (Long channelId : param.getChannelIds()) { |
|||
for (Long supplierId : param.getSupplierIds()) { |
|||
LambdaQueryWrapper<BmsSupplierChannel> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSupplierChannel::getChannelId,channelId); |
|||
lqw.eq(BmsSupplierChannel::getSupplierId,supplierId); |
|||
boolean exist = bmsSupplierChannelService.count(lqw)>0; |
|||
if(!exist){ |
|||
BmsSupplierChannel supplierChannel = new BmsSupplierChannel(); |
|||
supplierChannel.setSupplierId(supplierId); |
|||
supplierChannel.setChannelId(channelId); |
|||
bmsSupplierChannelService.save(supplierChannel); |
|||
} |
|||
} |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.BASE, title = "客户渠道关系", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:supplierChannel:delete')") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
if(ids.contains(",")){ |
|||
List<Long> idArr = Arrays.asList(ids.split(",")) |
|||
.stream().map(a->Long.parseLong(a)) |
|||
.collect(Collectors.toList()); |
|||
bmsSupplierChannelService.removeByIds(idArr); |
|||
}else { |
|||
bmsSupplierChannelService.removeById(Long.parseLong(ids)); |
|||
} |
|||
return R.ok(); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,551 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.*; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion2; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSupplierBo; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSupplierParentBo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsSupplierTreeVo; |
|||
import com.qs.serve.modules.bms.mapper.BmsSupplierMapper; |
|||
import com.qs.serve.modules.bms.service.BmsRegion2Service; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
import com.qs.serve.modules.his.entity.HisUserSupplier; |
|||
import com.qs.serve.modules.his.service.HisUserSupplierService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.entity.bo.SysRelateSuppliersParam; |
|||
import com.qs.serve.modules.sys.entity.bo.SysRelateSuppliersParam2; |
|||
import com.qs.serve.modules.sys.entity.dto.SysUserSimpleVo; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 客户 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplier") |
|||
public class BmsSupplierController { |
|||
|
|||
private BmsSupplierService bmsSupplierService; |
|||
private BmsRegionService bmsRegionService; |
|||
private BmsRegion2Service bmsRegion2Service; |
|||
private SysUserService sysUserService; |
|||
private BmsSupplierMapper bmsSupplierMapper; |
|||
private HisUserSupplierService hisUserSupplierService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
@PreAuthorize("hasRole('bms:supplier:query')") |
|||
public R<List<BmsSupplier>> getList(BmsSupplier param){ |
|||
String userId = param.getUserId(); |
|||
param.setCurrUserId(userId); |
|||
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
|||
initSupplierList(list); |
|||
initParentList(list); |
|||
for (BmsSupplier supplier : list) { |
|||
supplier.setMasterFlag(0); |
|||
if(supplier.getUserId()!=null&&supplier.getUserId().equals(userId)){ |
|||
supplier.setMasterFlag(1); |
|||
break; |
|||
} |
|||
} |
|||
return R.ok(list); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/page") |
|||
@PreAuthorize("hasRole('bms:supplier:query')") |
|||
public R<PageVo<BmsSupplier>> getPage(@RequestBody BmsSupplier param){ |
|||
if(param.getLoadByCurrent()!=null&¶m.getLoadByCurrent().equals(1)){ |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
//初始化
|
|||
hisUserSupplierService.initByUserId(userId,false); |
|||
HisUserSupplier userSupplier = param.toHisUserSupplier(userId,null); |
|||
LambdaQueryWrapper<HisUserSupplier> lqw = new LambdaQueryWrapper<>(userSupplier); |
|||
lqw.ne(HisUserSupplier::getSupplierId,0); |
|||
PageHelper.startPage(param.getPageNum(),param.getPageSize()); |
|||
List<HisUserSupplier> list = hisUserSupplierService.list(lqw); |
|||
List<BmsSupplier> supplierList = list.stream().map(HisUserSupplier::toSupplier).collect(Collectors.toList()); |
|||
return R.byPageHelperList(list,supplierList); |
|||
} |
|||
PageHelper.startPage(param.getPageNum(),param.getPageSize()); |
|||
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
|||
initSupplierList(list); |
|||
initParentList(list); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:supplier:query')") |
|||
public R<List<BmsSupplierTreeVo>> getTree(BmsSupplier param){ |
|||
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
|||
initSupplierList(list); |
|||
List<BmsSupplierTreeVo> list2 = list.stream().map(supplier->{ |
|||
BmsSupplierTreeVo treeNode = CopierUtil.copy(supplier,new BmsSupplierTreeVo()); |
|||
treeNode.setId(supplier.getId()); |
|||
treeNode.setParentId(supplier.getPid()); |
|||
treeNode.setSort(0); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
list2 = TreeUtil.buildByRecursive(list2,TreeUtil.DEFAULT_PID_STRING); |
|||
return R.ok(list2); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更改客户授权(用户页面) |
|||
* @return |
|||
*/ |
|||
@PostMapping("/relateSuppliers") |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> relateSuppliers(@RequestBody @Valid SysRelateSuppliersParam param){ |
|||
List<String> supplierIds = param.getSupplierIds(); |
|||
String userId = param.getUserId(); |
|||
List<BmsSupplier> list = bmsSupplierService.listByIds(supplierIds); |
|||
for (BmsSupplier supplier : list) { |
|||
if(userId.equals(supplier.getUserId())){ |
|||
continue; |
|||
} |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
boolean exist = false; |
|||
for (String otherUserId : supplier.getOtherUserIds()) { |
|||
if(userId.equals(otherUserId)){ |
|||
exist = true; |
|||
break; |
|||
} |
|||
} |
|||
if(exist){ |
|||
continue; |
|||
} |
|||
} |
|||
List<String> otherUserIds = new ArrayList<>(); |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
otherUserIds.addAll(Arrays.asList(supplier.getOtherUserIds())); |
|||
} |
|||
otherUserIds.add(userId); |
|||
//更新次要负责人
|
|||
BmsSupplier supplierParam = new BmsSupplier(); |
|||
supplierParam.setId(supplier.getId()); |
|||
supplierParam.setOtherUserIds(otherUserIds.toArray(new String[otherUserIds.size()])); |
|||
bmsSupplierService.updateById(supplierParam); |
|||
} |
|||
initSupplierOtherInfo(supplierIds); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 更改客户授权(客户页面) |
|||
* @return |
|||
*/ |
|||
@PostMapping("/relateSuppliers2") |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> relateSuppliers2(@RequestBody SysRelateSuppliersParam2 param){ |
|||
BmsSupplier supplier = bmsSupplierService.getById(param.getSupplierId()); |
|||
List<String> uids = param.getUserIds().stream() |
|||
.filter(uid->supplier.getUserId()==null || !supplier.getUserId().equals(uid)) |
|||
.collect(Collectors.toList()); |
|||
BmsSupplier bmsSupplier = new BmsSupplier(); |
|||
bmsSupplier.setId(param.getSupplierId().toString()); |
|||
bmsSupplier.setOtherUserIds(param.getUserIds()==null?new String[]{}:uids.toArray(new String[uids.size()])); |
|||
bmsSupplierService.updateById(bmsSupplier); |
|||
initSupplierOtherInfo(Arrays.asList(supplier.getId())); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 删除客户分配 |
|||
* @return |
|||
*/ |
|||
@PostMapping("/relateRemove") |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> relateRemove(@RequestBody SysRelateSuppliersParam param){ |
|||
List<String> supplierIds = param.getSupplierIds(); |
|||
String userId = param.getUserId(); |
|||
List<BmsSupplier> list = bmsSupplierService.listByIds(supplierIds); |
|||
for (BmsSupplier supplier : list) { |
|||
if(userId.equals(supplier.getUserId())){ |
|||
bmsSupplierMapper.removeRelateUserInfo(Long.parseLong(supplier.getId())); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
List<String> otherUserIds = new ArrayList<>(); |
|||
for (String otherUserId : supplier.getOtherUserIds()) { |
|||
if(userId.equals(otherUserId)){ |
|||
continue; |
|||
} |
|||
otherUserIds.add(otherUserId); |
|||
} |
|||
//更新次要负责人
|
|||
BmsSupplier supplierParam = new BmsSupplier(); |
|||
supplierParam.setId(supplier.getId()); |
|||
supplierParam.setOtherUserIds(otherUserIds.toArray(new String[otherUserIds.size()])); |
|||
bmsSupplierService.updateById(supplierParam); |
|||
} |
|||
} |
|||
initSupplierOtherInfo(supplierIds); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除客户分配 |
|||
* @return |
|||
*/ |
|||
@PostMapping("/relateRemove2") |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> relateRemove2(@RequestBody SysRelateSuppliersParam2 param){ |
|||
List<String> userIds = param.getUserIds(); |
|||
BmsSupplier supplier = bmsSupplierService.getById(param.getSupplierId()); |
|||
for (String userId : userIds) { |
|||
if(supplier.getUserId()!=null && userId.equals(supplier.getUserId())){ |
|||
bmsSupplierMapper.removeRelateUserInfo(Long.parseLong(supplier.getId())); |
|||
} |
|||
} |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
List<String> otherUserIds = new ArrayList<>(); |
|||
for (String otherUserId : supplier.getOtherUserIds()) { |
|||
if(!userIds.contains(otherUserId)){ |
|||
otherUserIds.add(otherUserId); |
|||
} |
|||
} |
|||
BmsSupplier supplier1 = new BmsSupplier(); |
|||
supplier1.setId(supplier.getId()); |
|||
supplier1.setOtherUserIds(otherUserIds.toArray(new String[otherUserIds.size()])); |
|||
bmsSupplierService.updateById(supplier1); |
|||
} |
|||
initSupplierOtherInfo(Arrays.asList(supplier.getId())); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 设置主要负责人 |
|||
* @param supplierId |
|||
* @param userId |
|||
* @return |
|||
*/ |
|||
@GetMapping("/setMainUser") |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> setMainUser(String supplierId,String userId){ |
|||
BmsSupplier supplier = bmsSupplierService.getById(supplierId); |
|||
if(supplier.getUserId()!=null&&supplier.getUserId().equals(userId)){ |
|||
return R.ok(); |
|||
} |
|||
SysUser sysUser = sysUserService.getById(userId); |
|||
BmsSupplier supplierParam = new BmsSupplier(); |
|||
supplierParam.setId(supplierId); |
|||
supplierParam.setUserId(sysUser.getId()); |
|||
supplierParam.setUserName(sysUser.getName()); |
|||
supplierParam.setUserCode(sysUser.getCode()); |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
List<String> otherUserIds = new ArrayList<>(Arrays.asList(supplier.getOtherUserIds())); |
|||
if(supplier.getUserId() != null){ |
|||
otherUserIds.add(supplier.getUserId()); |
|||
} |
|||
otherUserIds = otherUserIds.stream().filter(uid->!uid.equals(userId)).collect(Collectors.toList()); |
|||
Set<String> otherUserIdSet = new HashSet<>(otherUserIds); |
|||
String[] otherArr = otherUserIdSet.toArray(new String[otherUserIdSet.size()]); |
|||
supplierParam.setOtherUserIds(otherArr); |
|||
} |
|||
bmsSupplierService.updateById(supplierParam); |
|||
initSupplierOtherInfo(Arrays.asList(supplier.getId())); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 移除主要负责人 |
|||
* @param supplierId |
|||
* @return |
|||
*/ |
|||
@GetMapping("/setOtherUser") |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> setOtherUser(Long supplierId){ |
|||
BmsSupplier supplier = bmsSupplierService.getById(supplierId); |
|||
List<String> userIds = new ArrayList<>(); |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
userIds = Arrays.asList(supplier.getOtherUserIds()); |
|||
} |
|||
if(supplier.getUserId()==null){ |
|||
return R.ok(); |
|||
} |
|||
Set<String> otherUserIdSet = new HashSet<>(userIds); |
|||
otherUserIdSet.add(supplier.getUserId()); |
|||
String[] otherArr = otherUserIdSet.toArray(new String[otherUserIdSet.size()]); |
|||
bmsSupplierMapper.removeRelateUserInfo(supplierId); |
|||
BmsSupplier bmsSupplier = new BmsSupplier(); |
|||
bmsSupplier.setId(supplier.getId()); |
|||
bmsSupplier.setOtherUserIds(otherArr); |
|||
bmsSupplierService.updateById(bmsSupplier); |
|||
initSupplierOtherInfo(Arrays.asList(supplierId.toString())); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:supplier:query')") |
|||
public R<BmsSupplier> getById(@PathVariable("id") String id,Integer loadRegionInfo){ |
|||
BmsSupplier bmsSupplier = bmsSupplierService.getById(id); |
|||
if(StringUtils.hasText(bmsSupplier.getPid())&&!bmsSupplier.getPid().equals("0")){ |
|||
BmsSupplier parentInfo = bmsSupplierService.getById(bmsSupplier.getPid()); |
|||
bmsSupplier.setParentRegionInfo(parentInfo); |
|||
}else { |
|||
bmsSupplier.setPid(null); |
|||
} |
|||
BmsRegion region = bmsRegionService.getById(bmsSupplier.getRegionLast()); |
|||
if(region!=null){ |
|||
bmsSupplier.setRegionLabel(region.getName()); |
|||
} |
|||
BmsRegion2 region2 = bmsRegion2Service.getById(bmsSupplier.getRegion2Last()); |
|||
if(region2!=null){ |
|||
bmsSupplier.setRegion2Label(region2.getName()); |
|||
} |
|||
List<SysUserSimpleVo> userVos = new ArrayList<>(); |
|||
if(bmsSupplier.getUserId()!=null){ |
|||
SysUser sysUser = sysUserService.getById(bmsSupplier.getUserId()); |
|||
SysUserSimpleVo simpleVo = sysUser.toSimpleVo(true); |
|||
simpleVo.setSupplierMainFlag(1); |
|||
userVos.add(simpleVo); |
|||
} |
|||
if(CollectionUtil.isNotEmpty(bmsSupplier.getOtherUserIds())){ |
|||
List<SysUser> userList = sysUserService.listByIds(Arrays.asList(bmsSupplier.getOtherUserIds())); |
|||
List<SysUserSimpleVo> userVos2 = userList.stream().map(ur->{ |
|||
SysUserSimpleVo simpleVo = ur.toSimpleVo(true); |
|||
simpleVo.setSupplierMainFlag(0); |
|||
return simpleVo; |
|||
}).collect(Collectors.toList()); |
|||
userVos.addAll(userVos2); |
|||
} |
|||
if(loadRegionInfo!=null&&loadRegionInfo.equals(1)){ |
|||
BmsRegion obj1 = bmsRegionService.getById(bmsSupplier.getRegionFirst()); |
|||
BmsRegion obj2 = bmsRegionService.getById(bmsSupplier.getRegionSecond()); |
|||
BmsRegion obj3 = bmsRegionService.getById(bmsSupplier.getRegionThird()); |
|||
BmsRegion obj4 = bmsRegionService.getById(bmsSupplier.getRegionFourthly()); |
|||
bmsSupplier.setRegionFirstInfo(obj1); |
|||
bmsSupplier.setRegionSecondInfo(obj2); |
|||
bmsSupplier.setRegionThirdInfo(obj3); |
|||
bmsSupplier.setRegionFourthlyInfo(obj4); |
|||
BmsRegion2 obj11 = bmsRegion2Service.getById(bmsSupplier.getRegion2First()); |
|||
BmsRegion2 obj22 = bmsRegion2Service.getById(bmsSupplier.getRegion2Second()); |
|||
BmsRegion2 obj33 = bmsRegion2Service.getById(bmsSupplier.getRegion2Third()); |
|||
BmsRegion2 obj44 = bmsRegion2Service.getById(bmsSupplier.getRegion2Fourthly()); |
|||
bmsSupplier.setRegion2FirstInfo(obj11); |
|||
bmsSupplier.setRegion2SecondInfo(obj22); |
|||
bmsSupplier.setRegion2ThirdInfo(obj33); |
|||
bmsSupplier.setRegion2FourthlyInfo(obj44); |
|||
} |
|||
bmsSupplier.setUserVos(userVos); |
|||
return R.ok(bmsSupplier); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> updateById(@RequestBody BmsSupplierBo param){ |
|||
if(param.getId()==null){ |
|||
return R.error("id不能为空"); |
|||
} |
|||
bmsSupplierService.edit(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 更新父级ID |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateParent") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:supplier:update')") |
|||
public R<?> updateParent(@RequestBody BmsSupplierParentBo param){ |
|||
BmsSupplier supplier = new BmsSupplier(); |
|||
supplier.setId(param.getId()); |
|||
if(param.getPid()==null||param.getPid().equals(0L)){ |
|||
supplier.setPid("0"); |
|||
supplier.setParentCode("0"); |
|||
}else { |
|||
BmsSupplier parentNode = bmsSupplierService.getById(param.getPid()); |
|||
supplier.setPid(param.getPid()+""); |
|||
supplier.setParentCode(parentNode.getCode()); |
|||
} |
|||
bmsSupplierService.updateById(supplier); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:supplier:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSupplierBo param){ |
|||
bmsSupplierService.edit(param); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "供应商", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:supplier:delete')") |
|||
public R<?> deleteById(@PathVariable("id") String id){ |
|||
if(bmsSupplierService.listChild(id).size()>0){ |
|||
return R.error("含有子公司客户无法删除"); |
|||
} |
|||
bmsSupplierService.removeById(id); |
|||
//清空临时表
|
|||
hisUserSupplierService.cleanTable(); |
|||
return R.ok(); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 显示关联 |
|||
* @param list |
|||
*/ |
|||
private void initSupplierList(List<BmsSupplier> list){ |
|||
//设置销售区域
|
|||
List<String> regionIds = list.stream() |
|||
.filter(sup->sup.getRegionLast()!=null&&!sup.getRegionLast().equals("0")) |
|||
.map(BmsSupplier::getRegionLast).collect(Collectors.toList()); |
|||
List<BmsRegion> regionList = null; |
|||
if(CollectionUtil.isNotEmpty(regionIds)){ |
|||
regionList = bmsRegionService.listByIds(regionIds); |
|||
} |
|||
for (BmsSupplier supplier : list) { |
|||
String regionId = supplier.getRegionLast(); |
|||
if(regionId!=null&&CollectionUtil.isNotEmpty(regionList)){ |
|||
for (BmsRegion region : regionList) { |
|||
if(region.getId().equals(regionId)){ |
|||
supplier.setRegionLabel(region.getName()); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//设置行政区域
|
|||
List<String> region2Ids = list.stream() |
|||
.filter(sup->sup.getRegion2Last()!=null&&!sup.getRegion2Last().equals("0")) |
|||
.map(BmsSupplier::getRegion2Last).collect(Collectors.toList()); |
|||
List<BmsRegion2> region2List = null; |
|||
if(CollectionUtil.isNotEmpty(region2Ids)){ |
|||
region2List = bmsRegion2Service.listByIds(region2Ids); |
|||
} |
|||
for (BmsSupplier supplier : list) { |
|||
String region2Id = supplier.getRegion2Last(); |
|||
if(region2Id!=null&&CollectionUtil.isNotEmpty(region2List)){ |
|||
for (BmsRegion2 region : region2List) { |
|||
String regionId = region.getId(); |
|||
if(regionId.equals(region2Id)){ |
|||
supplier.setRegion2Label(region.getName()); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
private void initParentList(List<BmsSupplier> list){ |
|||
for (BmsSupplier supplier : list) { |
|||
if(StringUtils.hasText(supplier.getPid())&&!supplier.getPid().equals("0")){ |
|||
BmsSupplier parentInfo = bmsSupplierService.getById(supplier.getPid()); |
|||
supplier.setParentRegionInfo(parentInfo); |
|||
}else { |
|||
supplier.setPid(null); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 初始化其它信息 |
|||
* @param supplierIds |
|||
*/ |
|||
private void initSupplierOtherInfo(List<String> supplierIds){ |
|||
List<BmsSupplier> suppliers = bmsSupplierService.listByIds(supplierIds); |
|||
List<BmsSupplier> updParams = new ArrayList<>(); |
|||
for (BmsSupplier supplier : suppliers) { |
|||
if(CollectionUtil.isNotEmpty(supplier.getOtherUserIds())){ |
|||
List<String> otherUserIds = Arrays.asList(supplier.getOtherUserIds()); |
|||
BmsSupplier param = new BmsSupplier(); |
|||
param.setId(supplier.getId()); |
|||
if(otherUserIds.size()>0){ |
|||
List<SysUser> userList = sysUserService.listByIds(otherUserIds); |
|||
String codes = userList.stream().map(SysUser::getCode).collect(Collectors.joining(",")); |
|||
String names = userList.stream().map(SysUser::getName).collect(Collectors.joining(",")); |
|||
param.setOtherUserCodes(codes); |
|||
param.setOtherUserNames(names); |
|||
}else { |
|||
param.setOtherUserCodes(""); |
|||
param.setOtherUserNames(""); |
|||
} |
|||
updParams.add(param); |
|||
} |
|||
} |
|||
if(CollectionUtil.isNotEmpty(updParams)){ |
|||
bmsSupplierService.updateBatchById(updParams); |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,47 @@ |
|||
package com.qs.serve.modules.bms.controller.api; |
|||
|
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.bms.service.BmsRegionService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* API基础档案 区域档案 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/api/region") |
|||
public class BmsRegionApi { |
|||
|
|||
private BmsRegionService bmsRegionService; |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
public R<List<BmsRegionTreeVo>> getTree(){ |
|||
return R.ok(bmsRegionService.getTree(false)); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BmsRegion> getById(@PathVariable("id") String id){ |
|||
BmsRegion bmsRegion = bmsRegionService.getById(id); |
|||
return R.ok(bmsRegion); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,154 @@ |
|||
package com.qs.serve.modules.bms.controller.api; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.util.AuthContextUtils; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierAddress; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierAddressService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* API基础档案 客户收货地址 |
|||
* @author YenHex |
|||
* @since 2022-10-12 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("api/supplierAddress") |
|||
public class BmsSupplierAddressApi { |
|||
|
|||
private BmsSupplierAddressService bmsSupplierAddressService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BmsSupplierAddress>> getPage(BmsSupplierAddress param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(Long.parseLong(supplier.getId())); |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsSupplierAddress> supplierAddressWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSupplierAddress> list = bmsSupplierAddressService.list(supplierAddressWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public R<List<BmsSupplierAddress>> getList(BmsSupplierAddress param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(Long.parseLong(supplier.getId())); |
|||
LambdaQueryWrapper<BmsSupplierAddress> supplierAddressWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSupplierAddress> list = bmsSupplierAddressService.list(supplierAddressWrapper); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BmsSupplierAddress> getById(@PathVariable("id") String id){ |
|||
BmsSupplierAddress bmsSupplierAddress = bmsSupplierAddressService.getById(id); |
|||
return R.ok(bmsSupplierAddress); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplierAddress param){ |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getById(param.getId()); |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
if(supplierAddress.getSupplierId().toString().equals(supplier.getId())){ |
|||
param.setDefaultFlag(null); |
|||
boolean result = bmsSupplierAddressService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
return R.error("错误id"); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid BmsSupplierAddress param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(param.getSupplierId()); |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getDefault(Long.parseLong(supplier.getId())); |
|||
if(supplierAddress==null){ |
|||
param.setDefaultFlag(1); |
|||
}else { |
|||
param.setDefaultFlag(0); |
|||
} |
|||
boolean result = bmsSupplierAddressService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 设置默认的地址 |
|||
* @param id 地址ID |
|||
* @return |
|||
*/ |
|||
@PostMapping("/setDefault") |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public R<?> setDefault(@Valid Long id){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getById(id); |
|||
if(!supplierAddress.getSupplierId().toString().equals(supplier.getId())){ |
|||
return R.error("错误id"); |
|||
} |
|||
List<BmsSupplierAddress> list = bmsSupplierAddressService.listBySupplierId(supplierAddress.getSupplierId()); |
|||
//设置其它
|
|||
for (BmsSupplierAddress address : list) { |
|||
if(!address.getId().equals(id)){ |
|||
address.setDefaultFlag(0); |
|||
bmsSupplierAddressService.updateById(address); |
|||
} |
|||
} |
|||
//设置默认
|
|||
supplierAddress.setDefaultFlag(1); |
|||
bmsSupplierAddressService.updateById(supplierAddress); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
BmsSupplierAddress supplierAddress = bmsSupplierAddressService.getById(id); |
|||
if(!supplierAddress.getSupplierId().toString().equals(supplier.getId())){ |
|||
return R.error("错误id"); |
|||
} |
|||
boolean result = bmsSupplierAddressService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,93 @@ |
|||
package com.qs.serve.modules.bms.controller.api; |
|||
|
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.TreeUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsSupplierTreeVo; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import com.qs.serve.modules.wx.entity.WxUser; |
|||
import com.qs.serve.modules.wx.service.WxUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* API基础档案 客户 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/api/supplier") |
|||
public class BmsSupplierApi { |
|||
|
|||
private final BmsSupplierService bmsSupplierService; |
|||
private final WxUserService wxUserService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BmsSupplier>> getPage(BmsSupplier param){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.byEmptyList(); |
|||
} |
|||
param.setCurrUserId(wxUser.getSysUserId()); |
|||
param.setStopFlag(0); |
|||
PageUtil.startPage(); |
|||
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 树查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
//@GetMapping("/tree")
|
|||
public R<List<BmsSupplierTreeVo>> getTree(BmsSupplier param){ |
|||
WxUser wxUser = wxUserService.getCurrentWxUser(); |
|||
if(wxUser.getSysUserId()==null||wxUser.getSysUserId().equals("0")){ |
|||
return R.ok(new ArrayList<>()); |
|||
} |
|||
param.setCurrUserId(wxUser.getSysUserId()); |
|||
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); |
|||
List<BmsSupplierTreeVo> list2 = list.stream().map(supplier->{ |
|||
BmsSupplierTreeVo treeNode = CopierUtil.copy(supplier,new BmsSupplierTreeVo()); |
|||
treeNode.setId(supplier.getId()); |
|||
treeNode.setParentId(supplier.getPid()); |
|||
treeNode.setSort(0); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
list2 = TreeUtil.buildByRecursive(list2,TreeUtil.DEFAULT_PID_STRING); |
|||
return R.ok(list2); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BmsSupplier> getById(@PathVariable("id") String id){ |
|||
BmsSupplier bmsSupplier = bmsSupplierService.getById(id); |
|||
return R.ok(bmsSupplier); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,115 @@ |
|||
package com.qs.serve.modules.bms.controller.api; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.util.AuthContextUtils; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierBand; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierBandService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* API基础档案 客户银行信息 |
|||
* @author YenHex |
|||
* @since 2022-10-12 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/api/supplierBand") |
|||
public class BmsSupplierBandApi { |
|||
|
|||
private BmsSupplierBandService bmsSupplierBandService; |
|||
|
|||
/** |
|||
* 翻页查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BmsSupplierBand>> getPage(BmsSupplierBand param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(Long.parseLong(supplier.getId())); |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsSupplierBand> supplierBandWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSupplierBand> list = bmsSupplierBandService.list(supplierBandWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 列表查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public R<List<BmsSupplierBand>> getList(BmsSupplierBand param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(Long.parseLong(supplier.getId())); |
|||
LambdaQueryWrapper<BmsSupplierBand> supplierBandWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSupplierBand> list = bmsSupplierBandService.list(supplierBandWrapper); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BmsSupplierBand> getById(@PathVariable("id") String id){ |
|||
BmsSupplierBand bmsSupplierBand = bmsSupplierBandService.getById(id); |
|||
return R.ok(bmsSupplierBand); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 根据ID更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
public R<?> updateById(@RequestBody @Valid BmsSupplierBand param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(Long.parseLong(supplier.getId())); |
|||
BmsSupplierBand bmsSupplierBand = bmsSupplierBandService.getById(param.getId()); |
|||
if(!bmsSupplierBand.getSupplierId().toString().equals(supplier.getId())){ |
|||
return R.error("未授权"); |
|||
} |
|||
boolean result = bmsSupplierBandService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid BmsSupplierBand param){ |
|||
BmsSupplier supplier = AuthContextUtils.getCurrentSupplier(); |
|||
param.setSupplierId(Long.parseLong(supplier.getId())); |
|||
boolean result = bmsSupplierBandService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
boolean result = bmsSupplierBandService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,84 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 渠道 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-07 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_channel") |
|||
public class BmsChannel implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 渠道编码 */ |
|||
@NotBlank(message = "渠道编码不能为空") |
|||
@Length(max = 50,message = "渠道编码长度不能超过50字") |
|||
private String channelCode; |
|||
|
|||
/** 渠道名称 */ |
|||
@NotBlank(message = "渠道名称不能为空") |
|||
@Length(max = 30,message = "渠道名称长度不能超过30字") |
|||
private String channelName; |
|||
|
|||
/** 渠道类型(读取数据字典) */ |
|||
@Length(max = 255,message = "渠道类型(读取数据字典)长度不能超过255字") |
|||
private String channelType; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 可投放费用标识 */ |
|||
private Integer costFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,136 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 渠道站点 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-07 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_channel_point") |
|||
public class BmsChannelPoint implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 渠道名称 */ |
|||
@NotNull(message = "渠道名称不能为空") |
|||
private Long channelId; |
|||
|
|||
private String channelName; |
|||
|
|||
/** 站点编码 */ |
|||
@NotBlank(message = "站点编码不能为空") |
|||
@Length(max = 50,message = "站点编码长度不能超过50字") |
|||
private String pointCode; |
|||
|
|||
/** 站点名称 */ |
|||
@NotBlank(message = "站点名称不能为空") |
|||
@Length(max = 30,message = "站点名称长度不能超过30字") |
|||
private String pointName; |
|||
|
|||
/** 店铺面积 */ |
|||
@NotBlank(message = "店铺面积不能为空") |
|||
@Length(max = 255,message = "店铺面积长度不能超过255字") |
|||
private String shopArea; |
|||
|
|||
/** 收银台数量 */ |
|||
@NotNull(message = "收银台数量不能为空") |
|||
private Integer countCheckstand; |
|||
|
|||
/** 站点等级(读取字典值) */ |
|||
@Length(max = 255,message = "站点等级(读取字典值)长度不能超过255字") |
|||
private String pointLevel; |
|||
|
|||
/** 站点类型(读取字典值) */ |
|||
private String pointType; |
|||
|
|||
/** 详细地址 */ |
|||
@Length(max = 255,message = "详细地址长度不能超过255字") |
|||
private String address; |
|||
|
|||
/** 销售区域id */ |
|||
@NotNull(message = "销售区域id不能为空") |
|||
private String saleRegionId; |
|||
|
|||
/** 销售区域 */ |
|||
@NotBlank(message = "销售区域不能为空") |
|||
@Length(max = 255,message = "销售区域长度不能超过255字") |
|||
private String saleRegionPath; |
|||
|
|||
private String saleRegionPathIds; |
|||
|
|||
/** 行政区域id */ |
|||
@NotNull(message = "行政区域id不能为空") |
|||
private String bizRegionId; |
|||
|
|||
/** 行政区域 */ |
|||
@NotBlank(message = "行政区域不能为空") |
|||
@Length(max = 255,message = "行政区域长度不能超过255字") |
|||
private String bizRegionPath; |
|||
|
|||
private String bizRegionPathIds; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 可投放费用标识 */ |
|||
private Integer costFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
@TableField(exist = false) |
|||
private String saleRegionName; |
|||
|
|||
@TableField(exist = false) |
|||
private String bizRegionName; |
|||
|
|||
@TableField(exist = false) |
|||
private String supplierId; |
|||
} |
|||
|
@ -0,0 +1,92 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 成本中心 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-11 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_cost_center") |
|||
public class BmsCostCenter implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 编码 */ |
|||
@NotBlank(message = "编码不能为空") |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 层级 */ |
|||
@NotNull(message = "层级不能为空") |
|||
private Integer level; |
|||
|
|||
/** 父级节点 */ |
|||
@NotNull(message = "父级节点不能为空") |
|||
private Long pid; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 子节点 */ |
|||
@TableField(exist = false) |
|||
List<BmsCostCenter> childNode; |
|||
|
|||
} |
|||
|
@ -0,0 +1,76 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 工厂产地 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-20 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_factory") |
|||
public class BmsFactory implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@NotBlank(message = "编码不能为空") |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,117 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 负责人 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_master_user") |
|||
public class BmsMasterUser implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 类型:channel、point、center */ |
|||
@NotBlank(message = "类型不能为空") |
|||
@Length(max = 10,message = "类型长度不能超过10字") |
|||
private String type; |
|||
|
|||
/** 目标id */ |
|||
@NotBlank(message = "目标id不能为空") |
|||
@Length(max = 32,message = "目标id长度不能超过32字") |
|||
private String targetId; |
|||
|
|||
/** 用户id */ |
|||
@NotBlank(message = "用户id不能为空") |
|||
@Length(max = 32,message = "用户id长度不能超过32字") |
|||
private String userId; |
|||
|
|||
/** 主要负责人 */ |
|||
@NotNull(message = "主要负责人不能为空") |
|||
private Integer masterFlag; |
|||
|
|||
/** 拓展字段1 */ |
|||
@Length(max = 255,message = "拓展字段1长度不能超过255字") |
|||
private String sp1; |
|||
|
|||
/** 拓展字段2 */ |
|||
@Length(max = 255,message = "拓展字段2长度不能超过255字") |
|||
private String sp2; |
|||
|
|||
/** 拓展字段3 */ |
|||
@Length(max = 255,message = "拓展字段3长度不能超过255字") |
|||
private String sp3; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
@TableField(exist = false) |
|||
private Object userInfo; |
|||
|
|||
@TableField(exist = false) |
|||
private Object objectInfo; |
|||
|
|||
@TableField(exist = false) |
|||
private String centerName; |
|||
|
|||
@TableField(exist = false) |
|||
private String centerCode; |
|||
|
|||
@TableField(exist = false) |
|||
private String userName; |
|||
|
|||
@TableField(exist = false) |
|||
private String userCode; |
|||
} |
|||
|
@ -0,0 +1,107 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
|||
import lombok.Data; |
|||
import org.apache.ibatis.type.JdbcType; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区域档案 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Data |
|||
@TableName(value = "bms_region",autoResultMap = true) |
|||
public class BmsRegion implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.INPUT) |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
|
|||
/** 层级 */ |
|||
private Integer level; |
|||
|
|||
/** 祖级id */ |
|||
private String pathIds; |
|||
|
|||
/** 祖级id */ |
|||
private String pathNames; |
|||
|
|||
/** 工厂产地ID */ |
|||
@TableField(typeHandler = SplitStringTypeHandler.class,jdbcType= JdbcType.VARCHAR) |
|||
private String[] factoryIds; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
/** 工厂列表 */ |
|||
@TableField(exist = false) |
|||
private List<?> factoryInfos; |
|||
|
|||
@TableField(exist = false) |
|||
private List<BmsRegionUser> regionUsers; |
|||
|
|||
@TableField(exist = false) |
|||
private Object parentInfo; |
|||
|
|||
/** |
|||
* 子节点 |
|||
*/ |
|||
@TableField(exist = false) |
|||
List<BmsRegion> childNodes; |
|||
|
|||
} |
|||
|
@ -0,0 +1,95 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
|||
import lombok.Data; |
|||
import org.apache.ibatis.type.JdbcType; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.io.Serializable; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 区域档案 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-10 |
|||
*/ |
|||
@Data |
|||
@TableName(value = "bms_region2") |
|||
public class BmsRegion2 implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.INPUT) |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
|
|||
/** 层级 */ |
|||
private Integer level; |
|||
|
|||
/** 祖级id */ |
|||
private String pathIds; |
|||
|
|||
/** 祖级id */ |
|||
private String pathNames; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
@TableField(exist = false) |
|||
private List<BmsRegionUser> regionUsers; |
|||
|
|||
@TableField(exist = false) |
|||
private Object parentInfo; |
|||
|
|||
/** |
|||
* 子节点 |
|||
*/ |
|||
@TableField(exist = false) |
|||
List<BmsRegion2> childNodes; |
|||
} |
|||
|
@ -0,0 +1,98 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 区域负责人 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-02 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_region_user") |
|||
public class BmsRegionUser implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 类型:0=销售区域;1=行政区域 */ |
|||
@NotNull(message = "类型:0=销售区域;1=行政区域不能为空") |
|||
private Integer type; |
|||
|
|||
/** 区域id */ |
|||
@NotBlank(message = "区域id不能为空") |
|||
@Length(max = 32,message = "区域id长度不能超过32字") |
|||
private String regionId; |
|||
|
|||
/** 用户id */ |
|||
@NotBlank(message = "用户id不能为空") |
|||
@Length(max = 32,message = "用户id长度不能超过32字") |
|||
private String userId; |
|||
|
|||
/** 主要负责人 */ |
|||
@NotNull(message = "主要负责人不能为空") |
|||
private Integer masterFlag; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
|
|||
/** 区域名称 */ |
|||
@TableField(exist = false) |
|||
private String regionName; |
|||
|
|||
/** 区域编码 */ |
|||
@TableField(exist = false) |
|||
private String regionCode; |
|||
|
|||
/** 用户名称 */ |
|||
@TableField(exist = false) |
|||
private String userName; |
|||
|
|||
/** 用户编码 */ |
|||
@TableField(exist = false) |
|||
private String userCode; |
|||
|
|||
} |
|||
|
@ -0,0 +1,89 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 规则 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-19 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_rule") |
|||
public class BmsRule implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 规则名称 */ |
|||
@NotBlank(message = "规则名称不能为空") |
|||
@Length(max = 255,message = "规则名称长度不能超过255字") |
|||
private String name; |
|||
|
|||
/** 状态:0->关闭;1->启用; */ |
|||
@NotNull(message = "状态:0->关闭;1->启用;不能为空") |
|||
private Integer status; |
|||
|
|||
/** 开始时间 */ |
|||
@Length(max = 0,message = "开始时间长度不能超过0字") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime startTime; |
|||
|
|||
/** 结束时间 */ |
|||
@Length(max = 0,message = "结束时间长度不能超过0字") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
private LocalDateTime endTime; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,75 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 规则区域 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-21 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_rule_region") |
|||
public class BmsRuleRegion implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 规则ID */ |
|||
@NotNull(message = "规则ID不能为空") |
|||
private Long ruleId; |
|||
|
|||
/** 区域ID */ |
|||
@NotNull(message = "区域ID不能为空") |
|||
private String regionId; |
|||
|
|||
/** 类型:0->只售;1->禁售 */ |
|||
@NotNull(message = "类型:0->只售;1->禁售不能为空") |
|||
private Integer typeFlag; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,83 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 规则sku 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-21 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_rule_sku") |
|||
public class BmsRuleSku implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 规则id */ |
|||
@NotNull(message = "规则id不能为空") |
|||
private Long ruleId; |
|||
|
|||
/** skuId */ |
|||
@NotNull(message = "skuId不能为空") |
|||
private Long skuId; |
|||
|
|||
/** spuId */ |
|||
@NotNull(message = "spuId不能为空") |
|||
private Long spuId; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
@TableField(exist = false) |
|||
List<Long> selectSkuIds; |
|||
|
|||
} |
|||
|
@ -0,0 +1,79 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* sku供应商关联 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-17 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_sku_supplier") |
|||
public class BmsSkuSupplier implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 商品id */ |
|||
@NotNull(message = "商品id不能为空") |
|||
private Long spuId; |
|||
|
|||
/** skuId */ |
|||
@NotNull(message = "skuId不能为空") |
|||
private Long skuId; |
|||
|
|||
/** 供应商id */ |
|||
@NotNull(message = "供应商id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 禁售状态 */ |
|||
@NotNull(message = "禁售状态不能为空") |
|||
private Integer banStatus; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,90 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 科目 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-07 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_subject") |
|||
public class BmsSubject implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 科目名称 */ |
|||
@NotBlank(message = "科目名称不能为空") |
|||
@Length(max = 50,message = "科目名称长度不能超过50字") |
|||
private String subjectName; |
|||
|
|||
|
|||
|
|||
private String pathNames; |
|||
|
|||
/** 科目编码 */ |
|||
@NotBlank(message = "科目编码不能为空") |
|||
@Length(max = 50,message = "科目编码长度不能超过50字") |
|||
private String subjectCode; |
|||
|
|||
/** 父级id */ |
|||
@NotNull(message = "父级id不能为空") |
|||
private Long pid; |
|||
|
|||
@TableField(exist = false) |
|||
private String parName; |
|||
|
|||
private Integer level; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
} |
|||
|
@ -0,0 +1,265 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
|||
import com.qs.serve.modules.his.entity.HisUserSupplier; |
|||
import com.qs.serve.modules.sys.entity.dto.SysUserVo; |
|||
import lombok.Data; |
|||
import org.apache.ibatis.type.JdbcType; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 供应商 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Data |
|||
@TableName(value = "bms_supplier",autoResultMap = true) |
|||
public class BmsSupplier implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private String id; |
|||
|
|||
/** 一级区域ID */ |
|||
private String regionFirst; |
|||
|
|||
/** 二级区域ID */ |
|||
private String regionSecond; |
|||
|
|||
/** 三级区域ID */ |
|||
private String regionThird; |
|||
|
|||
/** 四级区域ID */ |
|||
private String regionFourthly; |
|||
|
|||
/** 最子级区域ID */ |
|||
private String regionLast; |
|||
|
|||
/** 行政一级区域ID */ |
|||
private String region2First; |
|||
|
|||
/** 行政二级区域ID */ |
|||
private String region2Second; |
|||
|
|||
/** 行政三级区域ID */ |
|||
private String region2Third; |
|||
|
|||
/** 行政四级区域ID */ |
|||
private String region2Fourthly; |
|||
|
|||
/** 行政最子级区域ID */ |
|||
private String region2Last; |
|||
|
|||
/** 详细地址 */ |
|||
private String address; |
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
@TableField(condition = SqlCondition.LIKE) |
|||
private String name; |
|||
|
|||
/** 客户编码 */ |
|||
@NotBlank(message = "客户编码不能为空") |
|||
@Length(max = 20,message = "客户编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级id */ |
|||
private String pid; |
|||
|
|||
private String parentCode; |
|||
|
|||
/** 负责人 */ |
|||
private String userId; |
|||
|
|||
/** 负责人 */ |
|||
private String userCode; |
|||
|
|||
/** 负责人 */ |
|||
private String userName; |
|||
|
|||
@TableField(typeHandler = SplitStringTypeHandler.class,jdbcType= JdbcType.VARCHAR) |
|||
private String[] otherUserIds; |
|||
|
|||
private String otherUserNames; |
|||
|
|||
private String otherUserCodes; |
|||
|
|||
/** 停用 */ |
|||
private Integer stopFlag; |
|||
|
|||
/** 所属账套 */ |
|||
private String belong; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
/** 初始化当前欠费 */ |
|||
@NotNull(message = "初始化当前欠费不能为空") |
|||
private BigDecimal initCurAmount; |
|||
|
|||
/** 初始化欠费(历史记录) */ |
|||
@NotNull(message = "初始化欠费(历史记录)不能为空") |
|||
private BigDecimal initHisAmount; |
|||
|
|||
/** 可投放费用标识 */ |
|||
private Integer costFlag; |
|||
|
|||
/** 当前用户ID */ |
|||
@TableField(exist = false) |
|||
private String currUserId; |
|||
|
|||
/** 多选:销售区域ID */ |
|||
@TableField(exist = false) |
|||
private List<String> regionIds; |
|||
|
|||
/** 多选:行政区域ID */ |
|||
@TableField(exist = false) |
|||
private String[] region2Ids; |
|||
|
|||
/** 销售区域 */ |
|||
@TableField(exist = false) |
|||
private String regionLabel; |
|||
|
|||
/** 行政区域 */ |
|||
@TableField(exist = false) |
|||
private String region2Label; |
|||
|
|||
/** 父级ID信息 */ |
|||
@TableField(exist = false) |
|||
private Object parentRegionInfo; |
|||
|
|||
/** 主要负责人标识 */ |
|||
@TableField(exist = false) |
|||
private Integer masterFlag; |
|||
|
|||
/** 其它负责人列表 */ |
|||
@TableField(exist = false) |
|||
List<?> userVos; |
|||
|
|||
/** |
|||
* 搜索:负责人 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private String searchUserName; |
|||
|
|||
/** |
|||
* 搜索:负责人编码 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private String searchUserCode; |
|||
|
|||
/** |
|||
* 值=1,过滤当前用户负责数据 |
|||
*/ |
|||
@TableField(exist = false) |
|||
private Integer loadByCurrent; |
|||
|
|||
/** 一级区域 */ |
|||
@TableField(exist = false) |
|||
private Object regionFirstInfo; |
|||
|
|||
/** 二级区域 */ |
|||
@TableField(exist = false) |
|||
private Object regionSecondInfo; |
|||
|
|||
/** 三级区域 */ |
|||
@TableField(exist = false) |
|||
private Object regionThirdInfo; |
|||
|
|||
/** 四级区域 */ |
|||
@TableField(exist = false) |
|||
private Object regionFourthlyInfo; |
|||
|
|||
/** 行政一级区域 */ |
|||
@TableField(exist = false) |
|||
private Object region2FirstInfo; |
|||
|
|||
/** 行政二级区域 */ |
|||
@TableField(exist = false) |
|||
private Object region2SecondInfo; |
|||
|
|||
/** 行政三级区域 */ |
|||
@TableField(exist = false) |
|||
private Object region2ThirdInfo; |
|||
|
|||
/** 行政四级区域 */ |
|||
@TableField(exist = false) |
|||
private Object region2FourthlyInfo; |
|||
|
|||
/** 翻页参数 */ |
|||
@TableField(exist = false) |
|||
private Integer pageNum; |
|||
|
|||
/** 翻页参数2 */ |
|||
@TableField(exist = false) |
|||
private Integer pageSize; |
|||
|
|||
public HisUserSupplier toHisUserSupplier(String userId,Integer type){ |
|||
HisUserSupplier userSupplier = new HisUserSupplier(); |
|||
userSupplier.setUserId(userId); |
|||
if(this.getUserId()!=null){ |
|||
userSupplier.setSupplierId(Long.parseLong(this.getId())); |
|||
} |
|||
if(this.getId()!=null){ |
|||
userSupplier.setSupplierId(Long.parseLong(this.getId())); |
|||
} |
|||
userSupplier.setSupplierName(this.getName()); |
|||
userSupplier.setSupplierCode(this.getCode()); |
|||
userSupplier.setSaleRegionFirst(this.getRegionFirst()); |
|||
userSupplier.setSaleRegionSecond(this.getRegionSecond()); |
|||
userSupplier.setSaleRegionThird(this.getRegionThird()); |
|||
userSupplier.setSaleRegionFourthly(this.getRegionFourthly()); |
|||
userSupplier.setBizRegionFirst(this.getRegion2First()); |
|||
userSupplier.setBizRegionSecond(this.getRegion2Second()); |
|||
userSupplier.setBizRegionThird(this.getRegion2Third()); |
|||
userSupplier.setBizRegionFourthly(this.getRegion2Fourthly()); |
|||
userSupplier.setType(type); |
|||
userSupplier.setCostFlag(this.costFlag); |
|||
return userSupplier; |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,124 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 供应商地址 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-21 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_supplier_address") |
|||
public class BmsSupplierAddress implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 供应商id */ |
|||
@NotNull(message = "供应商id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 是否默认 */ |
|||
@NotNull(message = "是否默认不能为空") |
|||
private Integer defaultFlag; |
|||
|
|||
/** 省编码 */ |
|||
@Length(max = 20,message = "省编码长度不能超过20字") |
|||
private String provinceCode; |
|||
|
|||
/** 省 */ |
|||
@NotBlank(message = "省不能为空") |
|||
@Length(max = 12,message = "省长度不能超过12字") |
|||
private String province; |
|||
|
|||
/** 市编码 */ |
|||
@Length(max = 20,message = "市编码长度不能超过20字") |
|||
private String cityCode; |
|||
|
|||
/** 市 */ |
|||
@NotBlank(message = "市不能为空") |
|||
@Length(max = 20,message = "市长度不能超过20字") |
|||
private String city; |
|||
|
|||
/** 区编码 */ |
|||
@Length(max = 20,message = "区编码长度不能超过20字") |
|||
private String areaCode; |
|||
|
|||
/** 区 */ |
|||
@NotBlank(message = "区不能为空") |
|||
@Length(max = 20,message = "区长度不能超过20字") |
|||
private String area; |
|||
|
|||
/** 详细地址 */ |
|||
@NotBlank(message = "详细地址不能为空") |
|||
@Length(max = 255,message = "详细地址长度不能超过255字") |
|||
private String detail; |
|||
|
|||
/** 手机号 */ |
|||
@NotBlank(message = "手机号不能为空") |
|||
@Length(max = 30,message = "手机号长度不能超过30字") |
|||
private String phone; |
|||
|
|||
/** 收件人 */ |
|||
@NotBlank(message = "收件人不能为空") |
|||
@Length(max = 30,message = "收件人长度不能超过30字") |
|||
private String receiver; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 客户名称 */ |
|||
@TableField(exist = false) |
|||
private String supplierName; |
|||
|
|||
/** 客户编码 */ |
|||
@TableField(exist = false) |
|||
private String supplierCode; |
|||
} |
|||
|
@ -0,0 +1,89 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 供应商地址 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-12 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_supplier_band") |
|||
public class BmsSupplierBand implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 供应商id */ |
|||
@NotNull(message = "供应商id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 开户银行 */ |
|||
@NotBlank(message = "开户银行不能为空") |
|||
@Length(max = 20,message = "开户银行长度不能超过20字") |
|||
private String cardBank; |
|||
|
|||
/** 银行卡号 */ |
|||
@NotBlank(message = "银行卡号不能为空") |
|||
@Length(max = 30,message = "银行卡号长度不能超过30字") |
|||
private String cardNum; |
|||
|
|||
/** 持卡人 */ |
|||
@NotBlank(message = "持卡人不能为空") |
|||
@Length(max = 20,message = "持卡人长度不能超过20字") |
|||
private String cardUser; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 客户名称 */ |
|||
@TableField(exist = false) |
|||
private String supplierName; |
|||
} |
|||
|
@ -0,0 +1,83 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 客户渠道关系 实体类 |
|||
* @author YenHex |
|||
* @since 2022-11-03 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_supplier_channel") |
|||
public class BmsSupplierChannel implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 渠道id */ |
|||
@NotNull(message = "渠道id不能为空") |
|||
private Long channelId; |
|||
|
|||
/** 客户id */ |
|||
@NotNull(message = "客户id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 最后更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 渠道名称 */ |
|||
@TableField(exist = false) |
|||
private String channelName; |
|||
|
|||
/** 客户名称 */ |
|||
@TableField(exist = false) |
|||
private String supplierName; |
|||
|
|||
/** 客户编码 */ |
|||
@TableField(exist = false) |
|||
private String supplierCode; |
|||
|
|||
} |
|||
|
@ -0,0 +1,71 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/7 |
|||
*/ |
|||
@Data |
|||
public class BmsChannelPointBo { |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 渠道名称 */ |
|||
@NotNull(message = "渠道名称不能为空") |
|||
private Long channelId; |
|||
|
|||
/** 站点编码 */ |
|||
@NotBlank(message = "站点编码不能为空") |
|||
@Length(max = 50,message = "站点编码长度不能超过50字") |
|||
private String pointCode; |
|||
|
|||
/** 站点名称 */ |
|||
@NotBlank(message = "站点名称不能为空") |
|||
@Length(max = 30,message = "站点名称长度不能超过30字") |
|||
private String pointName; |
|||
|
|||
/** 店铺面积 */ |
|||
@NotBlank(message = "店铺面积不能为空") |
|||
@Length(max = 255,message = "店铺面积长度不能超过255字") |
|||
private String shopArea; |
|||
|
|||
/** 收银台数量 */ |
|||
@NotNull(message = "收银台数量不能为空") |
|||
private Integer countCheckstand; |
|||
|
|||
/** 站点等级(读取字典值) */ |
|||
@Length(max = 255,message = "站点等级(读取字典值)长度不能超过255字") |
|||
private String pointLevel; |
|||
|
|||
/** 站点类型(读取字典值) */ |
|||
private String pointType; |
|||
|
|||
/** 详细地址 */ |
|||
@Length(max = 255,message = "详细地址长度不能超过255字") |
|||
private String address; |
|||
|
|||
/** 销售区域id */ |
|||
@NotNull(message = "销售区域id不能为空") |
|||
private String saleRegionId; |
|||
|
|||
/** 行政区域id */ |
|||
@NotNull(message = "行政区域id不能为空") |
|||
private String bizRegionId; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 可投放费用标识 */ |
|||
private Integer costFlag; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
@Data |
|||
public class BmsCostCenterBo { |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 编码 */ |
|||
@NotBlank(message = "编码不能为空") |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 层级 */ |
|||
// @NotNull(message = "层级不能为空")
|
|||
private Integer level; |
|||
|
|||
/** 父级节点 */ |
|||
@NotNull(message = "父级节点不能为空") |
|||
private Long pid; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 负责人 Bo |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserBo implements Serializable { |
|||
|
|||
/** id列表 */ |
|||
private List<String> targetIds; |
|||
|
|||
/** 类型 */ |
|||
@NotNull(message = "类型不能为空") |
|||
private String type; |
|||
|
|||
/** 用户id列表 */ |
|||
@NotNull(message = "用户id不能为空") |
|||
private List<String> userIds; |
|||
|
|||
} |
|||
|
@ -0,0 +1,36 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class BmsRegionBatchBo { |
|||
|
|||
private List<BmsRegionBo> regionList; |
|||
|
|||
@Data |
|||
public static class BmsRegionBo{ |
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/2 |
|||
*/ |
|||
@Data |
|||
public class BmsRegionUserBo { |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 类型:0=销售区域;1=行政区域 */ |
|||
@NotNull(message = "类型:0=销售区域;1=行政区域不能为空") |
|||
private Integer type; |
|||
|
|||
/** 区域id */ |
|||
@NotBlank(message = "区域id不能为空") |
|||
@Length(max = 32,message = "区域id长度不能超过32字") |
|||
private String regionId; |
|||
|
|||
/** 用户id */ |
|||
@NotBlank(message = "用户id不能为空") |
|||
@Length(max = 32,message = "用户id长度不能超过32字") |
|||
private String userId; |
|||
|
|||
/** 主要负责人 */ |
|||
@NotNull(message = "主要负责人不能为空") |
|||
private Integer masterFlag; |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/2 |
|||
*/ |
|||
@Data |
|||
public class BmsRegionUserSaveBo { |
|||
|
|||
/** 区域id列表 */ |
|||
private List<String> regionIds; |
|||
|
|||
/** 类型:0=销售区域;1=行政区域 */ |
|||
@NotNull(message = "类型:0=销售区域;1=行政区域不能为空") |
|||
private Integer type; |
|||
|
|||
/** 用户id列表 */ |
|||
@NotNull(message = "用户id不能为空") |
|||
private List<String> userIds; |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/17 |
|||
*/ |
|||
@Data |
|||
public class BmsRuleBo { |
|||
|
|||
/** |
|||
* 规则id |
|||
*/ |
|||
@NotNull |
|||
private Long id; |
|||
|
|||
private List<Long> skuIds; |
|||
|
|||
/** 只售区域id */ |
|||
private List<String> onlySaleRegionIds; |
|||
|
|||
/** 禁售区域id */ |
|||
private List<String> banSaleRegionIds; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/17 |
|||
*/ |
|||
@Data |
|||
public class BmsSkuSupplierBo { |
|||
|
|||
/** skuId */ |
|||
@NotNull(message = "skuId不能为空") |
|||
private Long skuId; |
|||
|
|||
/** 供应商id */ |
|||
@NotNull(message = "供应商id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 禁售状态 0可售 1禁售 */ |
|||
@NotNull(message = "禁售状态不能为空") |
|||
private Integer banStatus; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/17 |
|||
*/ |
|||
@Data |
|||
public class BmsSkuSupplierBo2 { |
|||
|
|||
/** 商品Id */ |
|||
@NotNull(message = "skuId不能为空") |
|||
private Long spuId; |
|||
|
|||
/** 供应商id */ |
|||
@NotNull(message = "供应商id不能为空") |
|||
private Long supplierId; |
|||
|
|||
/** 禁售状态 0可售 1禁售 */ |
|||
@NotNull(message = "禁售状态不能为空") |
|||
private Integer banStatus; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/13 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierBatchBo { |
|||
|
|||
@NotNull |
|||
private List<BmsSupplierDto> supplierList; |
|||
|
|||
@Data |
|||
public static class BmsSupplierDto{ |
|||
|
|||
/** 客户编码 */ |
|||
@NotBlank(message = "客户编码不能为空") |
|||
@Length(max = 20,message = "客户编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 客户父级编码(空为无父级) */ |
|||
private String parentCode; |
|||
|
|||
/** 销售区域编码 */ |
|||
private String regionCode; |
|||
|
|||
/** 行政区域编码 */ |
|||
private String region2Code; |
|||
|
|||
/** 客户地址 */ |
|||
private String address; |
|||
|
|||
/** 客户名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
private String name; |
|||
|
|||
/** 账套编码 */ |
|||
@NotBlank(message = "账套编码不能为空") |
|||
private String belong; |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/11 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierBo { |
|||
|
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 销售区域ID */ |
|||
@NotNull(message = "销售区域不能为空") |
|||
private String regionId; |
|||
|
|||
/** 行政区域ID */ |
|||
@NotNull(message = "行政区域不能为空") |
|||
private String regionId2; |
|||
|
|||
/** 详细地址 */ |
|||
private String address; |
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 客户编码 */ |
|||
@NotBlank(message = "客户编码不能为空") |
|||
@Length(max = 20,message = "客户编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级id,0表总公司无上级 */ |
|||
private Long pid; |
|||
|
|||
/** 负责人ID */ |
|||
private String mgrId; |
|||
|
|||
/** 其它负责人 */ |
|||
private String[] otherMgrIds; |
|||
|
|||
/** 可投放费用标识 */ |
|||
private Integer costFlag; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/10 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierChannelBo { |
|||
|
|||
/** 渠道id */ |
|||
@NotNull(message = "渠道id不能为空") |
|||
private List<Long> channelIds; |
|||
|
|||
/** 客户id */ |
|||
@NotNull(message = "客户id不能为空") |
|||
private List<Long> supplierIds; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/11 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierParentBo { |
|||
|
|||
/** id */ |
|||
@NotBlank |
|||
private String id; |
|||
|
|||
/** 父级id,0表总公司无上级 */ |
|||
private Long pid; |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.qs.serve.modules.bms.entity.so; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
|||
import com.qs.serve.modules.his.entity.HisUserSupplier; |
|||
import lombok.Data; |
|||
import org.apache.ibatis.type.JdbcType; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 供应商 实体类 |
|||
* @author YenHex |
|||
* @since 2022-10-11 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierSo implements Serializable { |
|||
|
|||
|
|||
/** 名称 */ |
|||
@NotBlank(message = "名称不能为空") |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 客户编码 */ |
|||
@NotBlank(message = "客户编码不能为空") |
|||
@Length(max = 20,message = "客户编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 生成费用开始时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime queryStartTime; |
|||
|
|||
/** 生成费用结束时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime queryEndTime; |
|||
} |
|||
|
@ -0,0 +1,37 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
@Data |
|||
public class BmsCostCenterTreeVo extends TreeNode { |
|||
|
|||
/** 科目名称 */ |
|||
@NotBlank(message = "成本中心名称不能为空") |
|||
@Length(max = 50,message = "成本中心名称长度不能超过50字") |
|||
private String name; |
|||
|
|||
/** 科目编码 */ |
|||
@NotBlank(message = "成本中心编码不能为空") |
|||
@Length(max = 50,message = "成本中心编码长度不能超过50字") |
|||
private String code; |
|||
|
|||
/** 父级id */ |
|||
@NotNull(message = "父级id不能为空") |
|||
private Long pid; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/15 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserCenterVo extends BmsMasterUser { |
|||
|
|||
private String userCode; |
|||
|
|||
private String userName; |
|||
|
|||
private String centerCode; |
|||
|
|||
private String centerName; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserChannelVo extends BmsMasterUser { |
|||
|
|||
private String userCode; |
|||
|
|||
private String userName; |
|||
|
|||
private String channelName; |
|||
|
|||
private String channelCode; |
|||
|
|||
private String pointName; |
|||
|
|||
private String pointCode; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserPointVo extends BmsMasterUser { |
|||
|
|||
private String userCode; |
|||
|
|||
private String userName; |
|||
|
|||
private String channelName; |
|||
|
|||
private String channelCode; |
|||
|
|||
private String pointName; |
|||
|
|||
private String pointCode; |
|||
|
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 负责人 VO |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserVo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
|
|||
/** 类型 */ |
|||
private String type; |
|||
|
|||
/** 目标id */ |
|||
private String targetId; |
|||
|
|||
/** 用户id */ |
|||
private String userId; |
|||
|
|||
/** 主要负责人 */ |
|||
private Integer masterFlag; |
|||
|
|||
/** 拓展字段1 */ |
|||
private String sp1; |
|||
|
|||
/** 拓展字段2 */ |
|||
private String sp2; |
|||
|
|||
/** 拓展字段3 */ |
|||
private String sp3; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,36 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class BmsRegionTreeVo extends TreeNode { |
|||
|
|||
/** id */ |
|||
private String id; |
|||
|
|||
/** 名称 */ |
|||
@Length(max = 20,message = "名称长度不能超过20字") |
|||
private String name; |
|||
|
|||
/** 编码 */ |
|||
@Length(max = 20,message = "编码长度不能超过20字") |
|||
private String code; |
|||
|
|||
/** 父级ID */ |
|||
@Length(max = 32,message = "父级ID长度不能超过32字") |
|||
private String pid; |
|||
|
|||
/** 层级 */ |
|||
private Integer level; |
|||
|
|||
private List<BmsRegionUser> regionUsers; |
|||
} |
@ -0,0 +1,33 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.qs.serve.modules.bms.entity.BmsSkuSupplier; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/17 |
|||
*/ |
|||
@Data |
|||
public class BmsSkuSupplierVo extends BmsSkuSupplier { |
|||
|
|||
/** 规格编码*/ |
|||
private String skuCode; |
|||
|
|||
/** 商品编码 */ |
|||
private String spuCode; |
|||
|
|||
/** 规格值 */ |
|||
private String specInfos; |
|||
|
|||
/** 商品标题 */ |
|||
private String spuTitle; |
|||
|
|||
private String supplierName; |
|||
|
|||
private String supplierCode; |
|||
|
|||
/** 搜索值 */ |
|||
private String searchValue; |
|||
|
|||
} |
@ -0,0 +1,40 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/7 |
|||
*/ |
|||
@Data |
|||
public class BmsSubjectTreeVo extends TreeNode { |
|||
|
|||
/** 科目名称 */ |
|||
@NotBlank(message = "科目名称不能为空") |
|||
@Length(max = 50,message = "科目名称长度不能超过50字") |
|||
private String subjectName; |
|||
|
|||
private String pathNames; |
|||
|
|||
/** 科目编码 */ |
|||
@NotBlank(message = "科目编码不能为空") |
|||
@Length(max = 50,message = "科目编码长度不能超过50字") |
|||
private String subjectCode; |
|||
|
|||
/** 父级id */ |
|||
@NotNull(message = "父级id不能为空") |
|||
private Long pid; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,82 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.time.LocalDateTime; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/10/12 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierTreeVo extends TreeNode { |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private String id; |
|||
|
|||
/** 一级区域ID */ |
|||
private String regionFirst; |
|||
|
|||
/** 二级区域ID */ |
|||
private String regionSecond; |
|||
|
|||
/** 三级区域ID */ |
|||
private String regionThird; |
|||
|
|||
/** 详细地址 */ |
|||
private String address; |
|||
|
|||
/** 名称 */ |
|||
private String name; |
|||
|
|||
/** 客户编码 */ |
|||
private String code; |
|||
|
|||
/** 父级id */ |
|||
private String pid; |
|||
|
|||
/** 区域ID */ |
|||
private String regionId; |
|||
|
|||
private String regionLabel; |
|||
|
|||
/** 所属ERP信息 */ |
|||
private String belongLabel; |
|||
|
|||
/** 最子级区域ID */ |
|||
private String regionLast; |
|||
|
|||
|
|||
private String parentCode; |
|||
|
|||
/** 归属ERP编码,如JSL、JSB、KL 对应ERP信息表作显示 */ |
|||
@NotBlank(message = "客户编码不能为空") |
|||
private String belong; |
|||
|
|||
/** 行政一级区域ID */ |
|||
private String region2First; |
|||
|
|||
/** 行政二级区域ID */ |
|||
private String region2Second; |
|||
|
|||
/** 行政三级区域ID */ |
|||
private String region2Third; |
|||
|
|||
/** 行政最子级区域ID */ |
|||
private String region2Last; |
|||
|
|||
/** 行政标题 */ |
|||
private String region2Label; |
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
|
|||
/** |
|||
* 渠道 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-03 |
|||
*/ |
|||
public interface BmsChannelMapper extends BaseMapper<BmsChannel> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,29 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
|
|||
import java.util.List; |
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Update; |
|||
|
|||
/** |
|||
* 渠道站点 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-03 |
|||
*/ |
|||
public interface BmsChannelPointMapper extends BaseMapper<BmsChannelPoint> { |
|||
|
|||
@InterceptorIgnore(tenantLine = "1") |
|||
@Update("update bms_channel_point set sale_region_path = #{saleRegionPath} where sale_region_id = #{saleRegionId}") |
|||
int udpateSaleRegionPathBySaleRegionId(@Param("saleRegionPath") String saleRegionPath,String saleRegionId); |
|||
|
|||
@InterceptorIgnore(tenantLine = "1") |
|||
@Update("update bms_channel_point set biz_region_path = #{bizRegionPath} where biz_region_id = #{bizRegionId}") |
|||
int udpateBizRegionPathByBizRegionId(@Param("bizRegionPath") String bizRegionPath,String bizRegionId); |
|||
|
|||
List<BmsChannelPoint> selectChannelPointList(@Param("query") BmsChannelPoint channelPoint); |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsCostCenter; |
|||
|
|||
/** |
|||
* 成本中心 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-13 |
|||
*/ |
|||
public interface BmsCostCenterMapper extends BaseMapper<BmsCostCenter> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsFactory; |
|||
|
|||
/** |
|||
* 工厂产地 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-20 |
|||
*/ |
|||
public interface BmsFactoryMapper extends BaseMapper<BmsFactory> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,41 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserCenterVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserPointVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 负责人 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-10 |
|||
*/ |
|||
public interface BmsMasterUserMapper extends BaseMapper<BmsMasterUser> { |
|||
|
|||
/** |
|||
* 查询渠道负责人 |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
List<BmsMasterUserChannelVo> selectChannelMasterUserList(@Param("query") BmsMasterUserChannelVo userChannel); |
|||
|
|||
/** |
|||
* 查询站点负责人 |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
List<BmsMasterUserPointVo> selectPointMasterUserList(@Param("query") BmsMasterUserPointVo userChannel); |
|||
|
|||
/** |
|||
* 查询成本中心负责人 |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
List<BmsMasterUserCenterVo> selectCenterMasterUserList(@Param("query") BmsMasterUser userChannel); |
|||
|
|||
} |
|||
|
@ -0,0 +1,19 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion2; |
|||
import org.apache.ibatis.annotations.Update; |
|||
|
|||
/** |
|||
* 区域档案 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-10 |
|||
*/ |
|||
public interface BmsRegion2Mapper extends BaseMapper<BmsRegion2> { |
|||
|
|||
@Update("update bms_region2 set path_ids = null , path_names = null,level = -1") |
|||
int updateSetPathNull(); |
|||
|
|||
} |
|||
|
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsRegion; |
|||
import org.apache.ibatis.annotations.Update; |
|||
|
|||
/** |
|||
* 区域档案 Mapper |
|||
* @author YenHex |
|||
* @date 2022-10-10 |
|||
*/ |
|||
public interface BmsRegionMapper extends BaseMapper<BmsRegion> { |
|||
|
|||
@Update("update bms_region set path_ids = null , path_names = null,level = -1") |
|||
int updateSetPathNull(); |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
|
|||
/** |
|||
* 区域负责人 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-02 |
|||
*/ |
|||
public interface BmsRegionUserMapper extends BaseMapper<BmsRegionUser> { |
|||
|
|||
} |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue