|
@@ -25,6 +25,7 @@ import com.unis.module.coding.service.cwxx.CwxxService;
|
25
|
25
|
import com.unis.module.coding.service.cwxxyear.CwxxYearService;
|
26
|
26
|
import com.unis.module.coding.service.dwxx.DwxxService;
|
27
|
27
|
import com.unis.module.coding.service.kqxx.KqxxService;
|
|
28
|
+import lombok.extern.slf4j.Slf4j;
|
28
|
29
|
import org.springframework.stereotype.Service;
|
29
|
30
|
import org.springframework.transaction.annotation.Transactional;
|
30
|
31
|
|
|
@@ -41,6 +42,7 @@ import static com.unis.module.infra.enums.ErrorCodeConstants.ERROR;
|
41
|
42
|
* @create 2025-01-22 15:28
|
42
|
43
|
*/
|
43
|
44
|
@Service
|
|
45
|
+@Slf4j
|
44
|
46
|
public class DeliveryServiceImpl implements DeliveryService {
|
45
|
47
|
@Resource
|
46
|
48
|
private DwxxService dwxxService;
|
|
@@ -79,12 +81,16 @@ public class DeliveryServiceImpl implements DeliveryService {
|
79
|
81
|
public Object createByAll(DeliverySaveVO createReqVO) {
|
80
|
82
|
// 单位信息
|
81
|
83
|
if (ObjectUtils.isNotEmpty(createReqVO.getDwxxReqVO())) {
|
|
84
|
+ if (ObjectUtils.isEmpty(createReqVO.getDwxxReqVO().getTyxydm())) {
|
|
85
|
+ throw exception(ERROR, "统一信用编码为空");
|
|
86
|
+ }
|
82
|
87
|
//根据统一信用编码----添加之前查询是否已经添加过该单位
|
83
|
88
|
List<DwxxDO> tyxydm1 = dwxxMapper.selectList(new QueryWrapper<DwxxDO>().eq("TYXYDM", createReqVO.getDwxxReqVO().getTyxydm()));
|
84
|
89
|
Long dwxx = null;
|
85
|
90
|
if (CollectionUtils.isEmpty(tyxydm1)) {
|
86
|
91
|
dwxx = dwxxService.createDwxx(createReqVO.getDwxxReqVO());
|
87
|
92
|
} else {
|
|
93
|
+ log.info("根据统一信用编码查询之前已经添加过该单位({})", tyxydm1.get(0).getId());
|
88
|
94
|
dwxx = tyxydm1.get(0).getId();
|
89
|
95
|
}
|
90
|
96
|
// 库区信息
|
|
@@ -111,21 +117,11 @@ public class DeliveryServiceImpl implements DeliveryService {
|
111
|
117
|
String kqbm = "";
|
112
|
118
|
// 单位信息社会统一信用编码
|
113
|
119
|
String tyxydm = createReqVO.getDwxxReqVO().getTyxydm();
|
114
|
|
- if (tyxydm == null) {
|
115
|
|
- throw exception(ERROR, "统一信用编码为空");
|
116
|
|
- }
|
117
|
120
|
tyxydm = tyxydm.length() <= 18 ? tyxydm : tyxydm.substring(0, 18);
|
118
|
121
|
//企业性质
|
119
|
122
|
String qyxz = createReqVO.getDwxxReqVO().getQyxz();
|
120
|
123
|
//企业性质变成两位
|
121
|
124
|
kqbm = KQBMUtils.createKQBM(qyxz, tyxydm, kqdm);
|
122
|
|
-/* if (qyxz == null) {
|
123
|
|
- kqbm = "01" + tyxydm + kqdm;
|
124
|
|
- } else if (qyxz < 10) {
|
125
|
|
- kqbm = "0" + qyxz + tyxydm + kqdm;
|
126
|
|
- } else {
|
127
|
|
- kqbm = qyxz + tyxydm + kqdm;
|
128
|
|
- }*/
|
129
|
125
|
createReqVO.getKqxxReqVO().setKqbm(kqbm);
|
130
|
126
|
Long kqxx = kqxxService.createKqxx(createReqVO.getKqxxReqVO());
|
131
|
127
|
|
|
@@ -133,6 +129,7 @@ public class DeliveryServiceImpl implements DeliveryService {
|
133
|
129
|
// 仓房信息
|
134
|
130
|
if (CollectionUtils.isNotEmpty(createReqVO.getCaxxReqVOList())) {
|
135
|
131
|
createReqVO.getCaxxReqVOList().forEach(caxx -> {
|
|
132
|
+ caxx.setYxcf(1);
|
136
|
133
|
caxx.setKqid(kqxx);
|
137
|
134
|
caxxService.createCaxx(caxx);
|
138
|
135
|
});
|