合并分支 'dev' 到 'test'
Dev 查看合并请求 !5
正在显示
14 个修改的文件
包含
134 行增加
和
47 行删除
| 1 | <component name="ProjectRunConfigurationManager"> | 1 | <component name="ProjectRunConfigurationManager"> |
| 2 | - <configuration default="false" name="Docker for Mac" type="docker-deploy" factoryName="dockerfile" server-name="Docker for Mac"> | 2 | + <configuration default="false" name="Docker for Mac" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> |
| 3 | <deployment type="dockerfile"> | 3 | <deployment type="dockerfile"> |
| 4 | <settings> | 4 | <settings> |
| 5 | - <option name="imageTag" value="" /> | 5 | + <option name="imageTag" value="latest" /> |
| 6 | <option name="containerName" value="allied-creation-cooperation" /> | 6 | <option name="containerName" value="allied-creation-cooperation" /> |
| 7 | + <option name="envVars"> | ||
| 8 | + <list> | ||
| 9 | + <DockerEnvVarImpl> | ||
| 10 | + <option name="name" value="POSTGRESQL_HOST" /> | ||
| 11 | + <option name="value" value="114.55.200.59" /> | ||
| 12 | + </DockerEnvVarImpl> | ||
| 13 | + <DockerEnvVarImpl> | ||
| 14 | + <option name="name" value="POSTGRESQL_DB_NAME" /> | ||
| 15 | + <option name="value" value="allied_creation_cooperation_dev" /> | ||
| 16 | + </DockerEnvVarImpl> | ||
| 17 | + <DockerEnvVarImpl> | ||
| 18 | + <option name="name" value="POSTGRESQL_PORT" /> | ||
| 19 | + <option name="value" value="31543" /> | ||
| 20 | + </DockerEnvVarImpl> | ||
| 21 | + <DockerEnvVarImpl> | ||
| 22 | + <option name="name" value="POSTGRESQL_PASSWORD" /> | ||
| 23 | + <option name="value" value="eagle1010" /> | ||
| 24 | + </DockerEnvVarImpl> | ||
| 25 | + </list> | ||
| 26 | + </option> | ||
| 27 | + <option name="portBindings"> | ||
| 28 | + <list> | ||
| 29 | + <DockerPortBindingImpl> | ||
| 30 | + <option name="containerPort" value="8082" /> | ||
| 31 | + <option name="hostPort" value="8082" /> | ||
| 32 | + </DockerPortBindingImpl> | ||
| 33 | + </list> | ||
| 34 | + </option> | ||
| 7 | <option name="sourceFilePath" value="Dockerfile" /> | 35 | <option name="sourceFilePath" value="Dockerfile" /> |
| 8 | </settings> | 36 | </settings> |
| 9 | </deployment> | 37 | </deployment> |
| @@ -15,3 +15,21 @@ RUN ["go","mod","tidy"] | @@ -15,3 +15,21 @@ RUN ["go","mod","tidy"] | ||
| 15 | RUN ["ls"] | 15 | RUN ["ls"] |
| 16 | RUN ["go","build"] | 16 | RUN ["go","build"] |
| 17 | ENTRYPOINT ["./allied-creation-cooperation"] | 17 | ENTRYPOINT ["./allied-creation-cooperation"] |
| 18 | + | ||
| 19 | +############################## | ||
| 20 | +### STEP 1 build executable binary | ||
| 21 | +############################## | ||
| 22 | +#FROM golang:latest AS builder | ||
| 23 | +#MAINTAINER 陈志颖 <steve.d.chan@qq.com> | ||
| 24 | +#RUN mkdir /app | ||
| 25 | +#WORKDIR /app | ||
| 26 | +#COPY . /app | ||
| 27 | +#RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | ||
| 28 | +#RUN GO111MODULE="on" GOPROXY="https://goproxy.cn" CGO_ENABLED=0 GOOS=linux go build -o allied-creation-cooperation | ||
| 29 | +# | ||
| 30 | +############################## | ||
| 31 | +### STEP 2 build a small image | ||
| 32 | +############################# | ||
| 33 | +#FROM scratch as final | ||
| 34 | +#COPY --from=builder /app/allied-creation-cooperation /app/allied-creation-cooperation | ||
| 35 | +#ENTRYPOINT ["./app/allied-creation-cooperation"] |
| @@ -859,7 +859,7 @@ func (cooperationApplicationService *CooperationApplicationService) CancelCooper | @@ -859,7 +859,7 @@ func (cooperationApplicationService *CooperationApplicationService) CancelCooper | ||
| 859 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("共创项目%s不存在", strconv.FormatInt(cooperationApplicationSaved.CooperationProject.CooperationProjectId, 10))) | 859 | return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("共创项目%s不存在", strconv.FormatInt(cooperationApplicationSaved.CooperationProject.CooperationProjectId, 10))) |
| 860 | } | 860 | } |
| 861 | // 更新共创项目申请统计 | 861 | // 更新共创项目申请统计 |
| 862 | - cooperationProject.ApplicantCount = cooperationProject.ApplicantCount - 1 | 862 | + //cooperationProject.ApplicantCount = cooperationProject.ApplicantCount - 1 |
| 863 | if _, err := cooperationProjectRepository.Save(cooperationProject); err != nil { | 863 | if _, err := cooperationProjectRepository.Save(cooperationProject); err != nil { |
| 864 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 864 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 865 | } | 865 | } |
| @@ -159,8 +159,12 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -159,8 +159,12 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | // 校验承接人是否属于承接对象,1员工,2共创用户,4公开 | 161 | // 校验承接人是否属于承接对象,1员工,2共创用户,4公开 |
| 162 | - if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 4) { | ||
| 163 | - if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, undertakerDomain.UserType) { | 162 | + if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, 3) { |
| 163 | + var userType int32 | ||
| 164 | + if undertakerDomain.UserType > 1024 { | ||
| 165 | + userType = undertakerDomain.UserType - 1024 | ||
| 166 | + } | ||
| 167 | + if !utils.IsContain(createCooperationContractCommand.CooperationContractUndertakerTypes, userType) { | ||
| 164 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象") | 168 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "承接人"+undertakerDomain.UserName+"不属于承接对象") |
| 165 | } | 169 | } |
| 166 | } | 170 | } |
| @@ -1020,8 +1024,12 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1020,8 +1024,12 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1020 | } | 1024 | } |
| 1021 | 1025 | ||
| 1022 | // 校验:判断用户类型是否属于承接对象 | 1026 | // 校验:判断用户类型是否属于承接对象 |
| 1023 | - if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 4) { // 非公开类型校验 | ||
| 1024 | - if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, undertakerDomain.UserType) { | 1027 | + if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, 3) { // 非公开类型校验 |
| 1028 | + var userType int32 | ||
| 1029 | + if undertakerDomain.UserType > 1024 { | ||
| 1030 | + userType = undertakerDomain.UserType - 1024 | ||
| 1031 | + } | ||
| 1032 | + if !utils.IsContain(cooperationContract.CooperationContractUndertakerTypes, userType) { | ||
| 1025 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象") | 1033 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "抱歉,您不属于当前项目的承接对象") |
| 1026 | } | 1034 | } |
| 1027 | } | 1035 | } |
| @@ -1172,7 +1180,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1172,7 +1180,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1172 | if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更 | 1180 | if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType && cooperationContractFound.IncentivesType == domain.TYPE_DIVIDNEDS_INCENTIVES && cooperationContractSaved.IncentivesType == domain.TYPE_MONEY_INCENTIVES { // 1.激励类型变更 |
| 1173 | // 业绩分红-->金额激励 | 1181 | // 业绩分红-->金额激励 |
| 1174 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) | 1182 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) |
| 1175 | - | ||
| 1176 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 | 1183 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 |
| 1177 | // 原业绩分红激励规则 | 1184 | // 原业绩分红激励规则 |
| 1178 | var dividendsIncentivesRuleOriginal string | 1185 | var dividendsIncentivesRuleOriginal string |
| @@ -1203,7 +1210,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1203,7 +1210,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1203 | // 金额激励-->业绩分红 | 1210 | // 金额激励-->业绩分红 |
| 1204 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) | 1211 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) |
| 1205 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 | 1212 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 |
| 1206 | - | ||
| 1207 | // 原金额激励规则 | 1213 | // 原金额激励规则 |
| 1208 | var moneyIncentivesRuleOriginal string | 1214 | var moneyIncentivesRuleOriginal string |
| 1209 | for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules { | 1215 | for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules { |
| @@ -1214,7 +1220,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1214,7 +1220,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1214 | "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" | 1220 | "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" |
| 1215 | } | 1221 | } |
| 1216 | moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" | 1222 | moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" |
| 1217 | - | ||
| 1218 | // 变更后的业绩分红激励规则 | 1223 | // 变更后的业绩分红激励规则 |
| 1219 | var dividendsIncentivesRuleChanged string | 1224 | var dividendsIncentivesRuleChanged string |
| 1220 | for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { | 1225 | for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { |
| @@ -1226,7 +1231,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1226,7 +1231,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1226 | "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" | 1231 | "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" |
| 1227 | } | 1232 | } |
| 1228 | dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】" | 1233 | dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleChanged + "】" |
| 1229 | - | ||
| 1230 | // 拼接规则变更 | 1234 | // 拼接规则变更 |
| 1231 | incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp | 1235 | incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleOriginalTmp |
| 1232 | } else { // 2.激励规则变更 | 1236 | } else { // 2.激励规则变更 |
| @@ -1235,7 +1239,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1235,7 +1239,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1235 | // 业绩分红-->业绩分红 | 1239 | // 业绩分红-->业绩分红 |
| 1236 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) | 1240 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) |
| 1237 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 | 1241 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 |
| 1238 | - | ||
| 1239 | // 原业绩分红激励规则 | 1242 | // 原业绩分红激励规则 |
| 1240 | var dividendsIncentivesRuleOriginal string | 1243 | var dividendsIncentivesRuleOriginal string |
| 1241 | for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules { | 1244 | for _, dividendsIncentivesRule := range cooperationContractFound.DividendsIncentivesRules { |
| @@ -1247,7 +1250,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1247,7 +1250,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1247 | "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" | 1250 | "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" |
| 1248 | } | 1251 | } |
| 1249 | dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】" | 1252 | dividendsIncentivesRuleOriginalTmp := "【" + dividendsIncentivesRuleOriginal + "】" |
| 1250 | - | ||
| 1251 | // 变更后的业绩分红激励规则 | 1253 | // 变更后的业绩分红激励规则 |
| 1252 | var dividendsIncentivesRuleChanged string | 1254 | var dividendsIncentivesRuleChanged string |
| 1253 | for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { | 1255 | for _, dividendsIncentivesRule := range cooperationContractSaved.DividendsIncentivesRules { |
| @@ -1259,7 +1261,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1259,7 +1261,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1259 | "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" | 1261 | "," + fmt.Sprint(dividendsIncentivesRule.SalesmanPercentage) + ";" |
| 1260 | } | 1262 | } |
| 1261 | dividendsIncentivesRuleChangedTmp := "【" + dividendsIncentivesRuleChanged + "】" | 1263 | dividendsIncentivesRuleChangedTmp := "【" + dividendsIncentivesRuleChanged + "】" |
| 1262 | - | ||
| 1263 | // 拼接规则变更 | 1264 | // 拼接规则变更 |
| 1264 | incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp | 1265 | incentivesRuleChangeDetail = dividendsIncentivesRuleOriginalTmp + " 变更为 " + dividendsIncentivesRuleChangedTmp |
| 1265 | } | 1266 | } |
| @@ -1267,7 +1268,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1267,7 +1268,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1267 | if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) { | 1268 | if !cooperationContract.MoneyIncentivesRuleSliceEqualBCE(cooperationContractFound.MoneyIncentivesRules, cooperationContractSaved.MoneyIncentivesRules) { |
| 1268 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) | 1269 | incentivesRuleChange = cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractFound.IncentivesType)) + "-->" + cooperationContract.ReturnIncentivesName(domain.IncentivesType(cooperationContractSaved.IncentivesType)) |
| 1269 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 | 1270 | //【第一阶段:20,2021-01-01~2021-12-31,,,;第二阶段:20,2021-01-01~2021-12-31,30,10】变更为【第一阶段:20,2021-01-01~2021-12-31,,,;】 |
| 1270 | - | ||
| 1271 | // 原金额激励规则 | 1271 | // 原金额激励规则 |
| 1272 | var moneyIncentivesRuleOriginal string | 1272 | var moneyIncentivesRuleOriginal string |
| 1273 | for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules { | 1273 | for _, moneyIncentivesRule := range cooperationContractFound.MoneyIncentivesRules { |
| @@ -1278,7 +1278,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1278,7 +1278,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1278 | "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" | 1278 | "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" |
| 1279 | } | 1279 | } |
| 1280 | moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" | 1280 | moneyIncentivesRuleOriginalTmp := "【" + moneyIncentivesRuleOriginal + "】" |
| 1281 | - | ||
| 1282 | // 变更后的激励规则 | 1281 | // 变更后的激励规则 |
| 1283 | var moneyIncentivesRuleChanged string | 1282 | var moneyIncentivesRuleChanged string |
| 1284 | for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules { | 1283 | for _, moneyIncentivesRule := range cooperationContractSaved.MoneyIncentivesRules { |
| @@ -1289,7 +1288,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -1289,7 +1288,6 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 1289 | "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" | 1288 | "," + fmt.Sprint(moneyIncentivesRule.SalesmanPercentage) + ";" |
| 1290 | } | 1289 | } |
| 1291 | moneyIncentivesRuleChangedTmp := "【" + moneyIncentivesRuleChanged + "】" | 1290 | moneyIncentivesRuleChangedTmp := "【" + moneyIncentivesRuleChanged + "】" |
| 1292 | - | ||
| 1293 | // 拼接规则变更 | 1291 | // 拼接规则变更 |
| 1294 | incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleChangedTmp | 1292 | incentivesRuleChangeDetail = moneyIncentivesRuleOriginalTmp + " 变更为 " + moneyIncentivesRuleChangedTmp |
| 1295 | } | 1293 | } |
| @@ -290,6 +290,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | @@ -290,6 +290,8 @@ func (cooperationProjectService *CooperationProjectService) GetCooperationProjec | ||
| 290 | undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3) | 290 | undertakerTypesUncheckedAvailable = append(undertakerTypesUncheckedAvailable, 3) |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | + // TODO 返回所有员工类型的申请通过人 | ||
| 294 | + | ||
| 293 | cooperationProjectDto := &dto.CooperationProjectsDto{} | 295 | cooperationProjectDto := &dto.CooperationProjectsDto{} |
| 294 | if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil { | 296 | if err := cooperationProjectDto.LoadDto(cooperationProject, nil, undertakerTypesUncheckedAvailable); err != nil { |
| 295 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 297 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| @@ -31,8 +31,7 @@ type MoneyIncentivesEstimateDto struct { | @@ -31,8 +31,7 @@ type MoneyIncentivesEstimateDto struct { | ||
| 31 | StageAndUndertaker []*StageAndUndertaker `json:"stageAndUndertaker"` | 31 | StageAndUndertaker []*StageAndUndertaker `json:"stageAndUndertaker"` |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | -func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract) error { | ||
| 35 | - // TODO 阶段承接人数据聚合 | 34 | +func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContract, stageAndUndertaker []*StageAndUndertaker) error { |
| 36 | dto.CooperationContractId = contract.CooperationContractId | 35 | dto.CooperationContractId = contract.CooperationContractId |
| 37 | dto.CooperationContractNumber = contract.CooperationContractNumber | 36 | dto.CooperationContractNumber = contract.CooperationContractNumber |
| 38 | dto.CooperationContractName = contract.CooperationContractName | 37 | dto.CooperationContractName = contract.CooperationContractName |
| @@ -40,9 +39,6 @@ func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContr | @@ -40,9 +39,6 @@ func (dto *MoneyIncentivesEstimateDto) LoadDto(contract *domain.CooperationContr | ||
| 40 | dto.Department = contract.Department | 39 | dto.Department = contract.Department |
| 41 | dto.CooperationContractSponsorName = contract.CooperationContractSponsor.UserName | 40 | dto.CooperationContractSponsorName = contract.CooperationContractSponsor.UserName |
| 42 | dto.CreatedAt = contract.CreatedAt | 41 | dto.CreatedAt = contract.CreatedAt |
| 43 | - dto.StageAndUndertaker = append(dto.StageAndUndertaker, &StageAndUndertaker{ | ||
| 44 | - Stage: 0, | ||
| 45 | - Undertakers: nil, | ||
| 46 | - }) | 42 | + dto.StageAndUndertaker = stageAndUndertaker |
| 47 | return nil | 43 | return nil |
| 48 | } | 44 | } |
| @@ -24,6 +24,8 @@ type ListDividendsIncentivesEstimateQuery struct { | @@ -24,6 +24,8 @@ type ListDividendsIncentivesEstimateQuery struct { | ||
| 24 | UserId int64 `cname:"用户ID" json:"userId"` | 24 | UserId int64 `cname:"用户ID" json:"userId"` |
| 25 | // 用户基础数据id | 25 | // 用户基础数据id |
| 26 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` | 26 | UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"` |
| 27 | + // 分红状态 | ||
| 28 | + OrderGoodDividendsStatus int32 `cname:"分红状态" json:"orderGoodDividendsStatus,omitempty"` | ||
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | func (listDividendsIncentivesEstimateQuery *ListDividendsIncentivesEstimateQuery) Valid(validation *validation.Validation) { | 31 | func (listDividendsIncentivesEstimateQuery *ListDividendsIncentivesEstimateQuery) Valid(validation *validation.Validation) { |
| @@ -28,6 +28,8 @@ type SearchDividendsIncentivesEstimateQuery struct { | @@ -28,6 +28,8 @@ type SearchDividendsIncentivesEstimateQuery struct { | ||
| 28 | PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` | 28 | PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"` |
| 29 | // 页面大小 | 29 | // 页面大小 |
| 30 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` | 30 | PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` |
| 31 | + // 分红状态 | ||
| 32 | + OrderGoodDividendsStatus int32 `cname:"分红状态" json:"orderGoodDividendsStatus,omitempty"` | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | func (searchDividendsIncentivesEstimateQuery *SearchDividendsIncentivesEstimateQuery) Valid(validation *validation.Validation) { | 35 | func (searchDividendsIncentivesEstimateQuery *SearchDividendsIncentivesEstimateQuery) Valid(validation *validation.Validation) { |
| @@ -68,6 +68,7 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | @@ -68,6 +68,7 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | ||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | // 获取订单产品 | 70 | // 获取订单产品 |
| 71 | + listDividendsIncentivesEstimateQuery.OrderGoodDividendsStatus = int32(1) | ||
| 71 | if count, orderGoods, err := orderGoodRepository.Find(tool_funs.SimpleStructToMap(listDividendsIncentivesEstimateQuery)); err != nil { | 72 | if count, orderGoods, err := orderGoodRepository.Find(tool_funs.SimpleStructToMap(listDividendsIncentivesEstimateQuery)); err != nil { |
| 72 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 73 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 73 | } else { | 74 | } else { |
| @@ -77,8 +78,8 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | @@ -77,8 +78,8 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | ||
| 77 | if orderGood.DividendsOrderNumber != "" { // 查询分红订单 | 78 | if orderGood.DividendsOrderNumber != "" { // 查询分红订单 |
| 78 | dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{ | 79 | dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{ |
| 79 | "dividendsOrderNumber": orderGood.DividendsOrderNumber, | 80 | "dividendsOrderNumber": orderGood.DividendsOrderNumber, |
| 80 | - "companyId": orderGood.CompanyId, | ||
| 81 | - "orgId": orderGood.OrgId, | 81 | + "companyId": listDividendsIncentivesEstimateQuery.CompanyId, |
| 82 | + "orgId": listDividendsIncentivesEstimateQuery.OrgId, | ||
| 82 | }) | 83 | }) |
| 83 | if err != nil { | 84 | if err != nil { |
| 84 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 85 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| @@ -92,8 +93,8 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | @@ -92,8 +93,8 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsIncentive | ||
| 92 | dividendsIncentivesEstimateDtos = append(dividendsIncentivesEstimateDtos, dividendsIncentivesEstimateDto) | 93 | dividendsIncentivesEstimateDtos = append(dividendsIncentivesEstimateDtos, dividendsIncentivesEstimateDto) |
| 93 | } else if orderGood.DividendsReturnedOrderNumber != "" { // 查询分红退货单 | 94 | } else if orderGood.DividendsReturnedOrderNumber != "" { // 查询分红退货单 |
| 94 | dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{ | 95 | dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{ |
| 95 | - "companyId": orderGood.CompanyId, | ||
| 96 | - "orgId": orderGood.OrgId, | 96 | + "companyId": listDividendsIncentivesEstimateQuery.CompanyId, |
| 97 | + "orgId": listDividendsIncentivesEstimateQuery.OrgId, | ||
| 97 | "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, | 98 | "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, |
| 98 | }) | 99 | }) |
| 99 | if err != nil { | 100 | if err != nil { |
| @@ -147,13 +148,11 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEst | @@ -147,13 +148,11 @@ func (dividendsEstimateService *DividendsEstimateService) ListMoneyIncentivesEst | ||
| 147 | if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(listMoneyIncentivesEstimateQuery)); err != nil { | 148 | if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(listMoneyIncentivesEstimateQuery)); err != nil { |
| 148 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 149 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 149 | } else { | 150 | } else { |
| 150 | - // TODO 判断承接人是否已分红 | ||
| 151 | - | ||
| 152 | // 数据传输对象 | 151 | // 数据传输对象 |
| 153 | var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto | 152 | var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto |
| 154 | for _, cooperationContract := range cooperationContracts { | 153 | for _, cooperationContract := range cooperationContracts { |
| 155 | moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{} | 154 | moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{} |
| 156 | - if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract); err != nil { | 155 | + if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract, nil); err != nil { |
| 157 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 156 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 158 | } | 157 | } |
| 159 | moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto) | 158 | moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto) |
| @@ -749,8 +748,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -749,8 +748,8 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
| 749 | } else { | 748 | } else { |
| 750 | // 获取产品ID | 749 | // 获取产品ID |
| 751 | orderGoodSavedIds := make([]int64, 0) | 750 | orderGoodSavedIds := make([]int64, 0) |
| 752 | - for _, dividendsEstimateSaved := range dividendsEstimatesSaved { | ||
| 753 | - orderGoodSavedIds = append(orderGoodSavedIds, dividendsEstimateSaved.OrderGoodId) | 751 | + for _, dividendsEstimate := range dividendsEstimates { |
| 752 | + orderGoodSavedIds = append(orderGoodSavedIds, dividendsEstimate.OrderGoodId) | ||
| 754 | } | 753 | } |
| 755 | 754 | ||
| 756 | // 获取订单产品 | 755 | // 获取订单产品 |
| @@ -899,7 +898,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | @@ -899,7 +898,7 @@ func (dividendsEstimateService *DividendsEstimateService) ConfirmDividendsIncent | ||
| 899 | } | 898 | } |
| 900 | 899 | ||
| 901 | return map[string]interface{}{ | 900 | return map[string]interface{}{ |
| 902 | - "report": fmt.Sprintf("已完成%d笔单订单分红预算,生成%d笔单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr), | 901 | + "report": fmt.Sprintf("已完成%d单订单分红预算,生成%d单分红预算,%d笔订单分红预算失败,失败原因:%s", len(estimateSuccessfullyDividendsOrders), successfullyCount, len(estimateFailedDividendsOrders), failedReasonStr), |
| 903 | }, nil | 902 | }, nil |
| 904 | } | 903 | } |
| 905 | } | 904 | } |
| @@ -1283,39 +1282,45 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti | @@ -1283,39 +1282,45 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti | ||
| 1283 | } | 1282 | } |
| 1284 | 1283 | ||
| 1285 | // 获取订单产品 | 1284 | // 获取订单产品 |
| 1285 | + searchDividendsIncentivesEstimateQuery.OrderGoodDividendsStatus = int32(1) // 查询带分红的产品 | ||
| 1286 | if count, orderGoods, err := orderGoodRepository.Find(tool_funs.SimpleStructToMap(searchDividendsIncentivesEstimateQuery)); err != nil { | 1286 | if count, orderGoods, err := orderGoodRepository.Find(tool_funs.SimpleStructToMap(searchDividendsIncentivesEstimateQuery)); err != nil { |
| 1287 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1287 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 1288 | } else { | 1288 | } else { |
| 1289 | var dividendsIncentivesEstimateDtos []*dto.DividendsIncentivesEstimateDto | 1289 | var dividendsIncentivesEstimateDtos []*dto.DividendsIncentivesEstimateDto |
| 1290 | for _, orderGood := range orderGoods { | 1290 | for _, orderGood := range orderGoods { |
| 1291 | - dividendsIncentivesEstimateDto := &dto.DividendsIncentivesEstimateDto{} | ||
| 1292 | if orderGood.DividendsOrderNumber != "" { // 查询分红订单 | 1291 | if orderGood.DividendsOrderNumber != "" { // 查询分红订单 |
| 1292 | + dividendsIncentivesEstimateDto := &dto.DividendsIncentivesEstimateDto{} | ||
| 1293 | dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{ | 1293 | dividendsOrder, err := dividendsOrderRepository.FindOne(map[string]interface{}{ |
| 1294 | "dividendsOrderNumber": orderGood.DividendsOrderNumber, | 1294 | "dividendsOrderNumber": orderGood.DividendsOrderNumber, |
| 1295 | - "companyId": orderGood.CompanyId, | ||
| 1296 | - "orgId": orderGood.OrgId, | 1295 | + "companyId": searchDividendsIncentivesEstimateQuery.CompanyId, |
| 1296 | + "orgId": searchDividendsIncentivesEstimateQuery.OrgId, | ||
| 1297 | }) | 1297 | }) |
| 1298 | if err != nil { | 1298 | if err != nil { |
| 1299 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1299 | + continue |
| 1300 | + //return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 1300 | } | 1301 | } |
| 1301 | if dividendsOrder == nil { | 1302 | if dividendsOrder == nil { |
| 1302 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber)) | 1303 | + continue |
| 1304 | + //return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsOrderNumber)) | ||
| 1303 | } | 1305 | } |
| 1304 | if err := dividendsIncentivesEstimateDto.LoadDto(orderGood, dividendsOrder.DividendsOrderNumber, dividendsOrder.DividendsOriginalOrderNum, dividendsOrder.CustomerName, dividendsOrder.Region.RegionName, dividendsOrder.OrderTime); err != nil { | 1306 | if err := dividendsIncentivesEstimateDto.LoadDto(orderGood, dividendsOrder.DividendsOrderNumber, dividendsOrder.DividendsOriginalOrderNum, dividendsOrder.CustomerName, dividendsOrder.Region.RegionName, dividendsOrder.OrderTime); err != nil { |
| 1305 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1307 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 1306 | } | 1308 | } |
| 1307 | dividendsIncentivesEstimateDtos = append(dividendsIncentivesEstimateDtos, dividendsIncentivesEstimateDto) | 1309 | dividendsIncentivesEstimateDtos = append(dividendsIncentivesEstimateDtos, dividendsIncentivesEstimateDto) |
| 1308 | } else if orderGood.DividendsReturnedOrderNumber != "" { // 查询分红退货单 | 1310 | } else if orderGood.DividendsReturnedOrderNumber != "" { // 查询分红退货单 |
| 1311 | + dividendsIncentivesEstimateDto := &dto.DividendsIncentivesEstimateDto{} | ||
| 1309 | dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{ | 1312 | dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{ |
| 1310 | "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, | 1313 | "dividendsReturnedOrderNumber": orderGood.DividendsReturnedOrderNumber, |
| 1311 | - "companyId": orderGood.CompanyId, | ||
| 1312 | - "orgId": orderGood.OrgId, | 1314 | + "companyId": searchDividendsIncentivesEstimateQuery.CompanyId, |
| 1315 | + "orgId": searchDividendsIncentivesEstimateQuery.OrgId, | ||
| 1313 | }) | 1316 | }) |
| 1314 | if err != nil { | 1317 | if err != nil { |
| 1315 | - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1318 | + continue |
| 1319 | + //return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 1316 | } | 1320 | } |
| 1317 | if dividendsReturnedOrder == nil { | 1321 | if dividendsReturnedOrder == nil { |
| 1318 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsReturnedOrderNumber)) | 1322 | + continue |
| 1323 | + //return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", orderGood.DividendsReturnedOrderNumber)) | ||
| 1319 | } | 1324 | } |
| 1320 | if err := dividendsIncentivesEstimateDto.LoadDto(orderGood, dividendsReturnedOrder.DividendsReturnedOrderNumber, dividendsReturnedOrder.OriginalOrderNum, dividendsReturnedOrder.DividendsReturnedCustomerName, dividendsReturnedOrder.Region.RegionName, dividendsReturnedOrder.OrderTime); err != nil { | 1325 | if err := dividendsIncentivesEstimateDto.LoadDto(orderGood, dividendsReturnedOrder.DividendsReturnedOrderNumber, dividendsReturnedOrder.OriginalOrderNum, dividendsReturnedOrder.DividendsReturnedCustomerName, dividendsReturnedOrder.Region.RegionName, dividendsReturnedOrder.OrderTime); err != nil { |
| 1321 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1326 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| @@ -1348,6 +1353,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE | @@ -1348,6 +1353,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE | ||
| 1348 | defer func() { | 1353 | defer func() { |
| 1349 | _ = transactionContext.RollbackTransaction() | 1354 | _ = transactionContext.RollbackTransaction() |
| 1350 | }() | 1355 | }() |
| 1356 | + | ||
| 1351 | // 共创合约仓储初始化 | 1357 | // 共创合约仓储初始化 |
| 1352 | var cooperationContractRepository domain.CooperationContractRepository | 1358 | var cooperationContractRepository domain.CooperationContractRepository |
| 1353 | if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ | 1359 | if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ |
| @@ -1357,6 +1363,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE | @@ -1357,6 +1363,10 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE | ||
| 1357 | } else { | 1363 | } else { |
| 1358 | cooperationContractRepository = value | 1364 | cooperationContractRepository = value |
| 1359 | } | 1365 | } |
| 1366 | + | ||
| 1367 | + // TODO 阶段承接人列表 | ||
| 1368 | + stageAndUndertaker := make([]*dto.StageAndUndertaker, 0) | ||
| 1369 | + | ||
| 1360 | // 查找共创合约 | 1370 | // 查找共创合约 |
| 1361 | searchMoneyIncentivesEstimateQuery.IncentivesType = 2 | 1371 | searchMoneyIncentivesEstimateQuery.IncentivesType = 2 |
| 1362 | if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(searchMoneyIncentivesEstimateQuery)); err != nil { | 1372 | if count, cooperationContracts, err := cooperationContractRepository.Find(tool_funs.SimpleStructToMap(searchMoneyIncentivesEstimateQuery)); err != nil { |
| @@ -1364,8 +1374,13 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE | @@ -1364,8 +1374,13 @@ func (dividendsEstimateService *DividendsEstimateService) SearchMoneyIncentivesE | ||
| 1364 | } else { | 1374 | } else { |
| 1365 | var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto | 1375 | var moneyIncentivesEstimateDtos []*dto.MoneyIncentivesEstimateDto |
| 1366 | for _, cooperationContract := range cooperationContracts { | 1376 | for _, cooperationContract := range cooperationContracts { |
| 1377 | + // TODO 判断承接人是否已分红 | ||
| 1378 | + //for _, undertaker := range cooperationContract.Undertakers { | ||
| 1379 | + // | ||
| 1380 | + //} | ||
| 1381 | + | ||
| 1367 | moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{} | 1382 | moneyIncentivesEstimateDto := &dto.MoneyIncentivesEstimateDto{} |
| 1368 | - if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract); err != nil { | 1383 | + if err := moneyIncentivesEstimateDto.LoadDto(cooperationContract, stageAndUndertaker); err != nil { |
| 1369 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 1384 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 1370 | } | 1385 | } |
| 1371 | moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto) | 1386 | moneyIncentivesEstimateDtos = append(moneyIncentivesEstimateDtos, moneyIncentivesEstimateDto) |
| @@ -265,6 +265,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | @@ -265,6 +265,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | ||
| 265 | defer func() { | 265 | defer func() { |
| 266 | _ = transactionContext.RollbackTransaction() | 266 | _ = transactionContext.RollbackTransaction() |
| 267 | }() | 267 | }() |
| 268 | + // 退货单仓储初始化 | ||
| 268 | var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository | 269 | var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository |
| 269 | if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{ | 270 | if value, err := factory.CreateDividendsReturnedOrderRepository(map[string]interface{}{ |
| 270 | "transactionContext": transactionContext, | 271 | "transactionContext": transactionContext, |
| @@ -273,7 +274,15 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | @@ -273,7 +274,15 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | ||
| 273 | } else { | 274 | } else { |
| 274 | dividendsReturnedOrderRepository = value | 275 | dividendsReturnedOrderRepository = value |
| 275 | } | 276 | } |
| 276 | - dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{"dividendsReturnedOrderId": getDividendsReturnedOrderQuery.DividendsReturnedOrderId}) | 277 | + |
| 278 | + // 查找退货单 | ||
| 279 | + dividendsReturnedOrderId, err := strconv.ParseInt(getDividendsReturnedOrderQuery.DividendsReturnedOrderId, 10, 64) | ||
| 280 | + if err != nil { | ||
| 281 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 282 | + } | ||
| 283 | + dividendsReturnedOrder, err := dividendsReturnedOrderRepository.FindOne(map[string]interface{}{ | ||
| 284 | + "dividendsReturnedOrderId": dividendsReturnedOrderId, | ||
| 285 | + }) | ||
| 277 | if err != nil { | 286 | if err != nil { |
| 278 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 287 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 279 | } | 288 | } |
| @@ -13,6 +13,7 @@ func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGoo | @@ -13,6 +13,7 @@ func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGoo | ||
| 13 | OrderGoodPrice: orderGoodModel.OrderGoodPrice, | 13 | OrderGoodPrice: orderGoodModel.OrderGoodPrice, |
| 14 | OrderGoodQuantity: orderGoodModel.OrderGoodQuantity, | 14 | OrderGoodQuantity: orderGoodModel.OrderGoodQuantity, |
| 15 | DividendsOrderNumber: orderGoodModel.DividendsOrderNumber, | 15 | DividendsOrderNumber: orderGoodModel.DividendsOrderNumber, |
| 16 | + DividendsReturnedOrderNumber: orderGoodModel.DividendsReturnedOrderNumber, | ||
| 16 | CooperationContractNumber: orderGoodModel.CooperationContractNumber, | 17 | CooperationContractNumber: orderGoodModel.CooperationContractNumber, |
| 17 | OrderGoodExpense: orderGoodModel.OrderGoodExpense, | 18 | OrderGoodExpense: orderGoodModel.OrderGoodExpense, |
| 18 | OrderGoodDividendsStatus: orderGoodModel.OrderGoodDividendsStatus, | 19 | OrderGoodDividendsStatus: orderGoodModel.OrderGoodDividendsStatus, |
| @@ -518,7 +518,8 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte | @@ -518,7 +518,8 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte | ||
| 518 | if err := orderGoodModelQuery. | 518 | if err := orderGoodModelQuery. |
| 519 | Where("company_id = ?", dividendsOrderModel.Company.CompanyId). | 519 | Where("company_id = ?", dividendsOrderModel.Company.CompanyId). |
| 520 | Where("org_id = ?", dividendsOrderModel.Org.OrgId). | 520 | Where("org_id = ?", dividendsOrderModel.Org.OrgId). |
| 521 | - Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil { | 521 | + Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber). |
| 522 | + Select(); err != nil { | ||
| 522 | return nil, fmt.Errorf("分红订单关联的产品不存在") | 523 | return nil, fmt.Errorf("分红订单关联的产品不存在") |
| 523 | } | 524 | } |
| 524 | // 聚合分红订单 | 525 | // 聚合分红订单 |
| @@ -488,8 +488,20 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str | @@ -488,8 +488,20 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str | ||
| 488 | tx := repository.transactionContext.PgTx | 488 | tx := repository.transactionContext.PgTx |
| 489 | dividendsReturnedOrderModel := new(models.DividendsReturnedOrder) | 489 | dividendsReturnedOrderModel := new(models.DividendsReturnedOrder) |
| 490 | query := sqlbuilder.BuildQuery(tx.Model(dividendsReturnedOrderModel), queryOptions) | 490 | query := sqlbuilder.BuildQuery(tx.Model(dividendsReturnedOrderModel), queryOptions) |
| 491 | - query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_id = ?", "dividendsReturnedOrderId") | ||
| 492 | - query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_number = ?", "dividendsReturnedOrderNumber") | 491 | + if dividendsReturnedOrderId, ok := queryOptions["dividendsReturnedOrderId"]; ok && dividendsReturnedOrderId.(int64) != 0 { |
| 492 | + query.Where("dividends_returned_order.dividends_returned_order_id = ?", dividendsReturnedOrderId) | ||
| 493 | + } | ||
| 494 | + //query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_id = ?", "dividendsReturnedOrderId") | ||
| 495 | + //query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_number = ?", "dividendsReturnedOrderNumber") | ||
| 496 | + if dividendsReturnedOrderNumber, ok := queryOptions["dividendsReturnedOrderNumber"]; ok && dividendsReturnedOrderNumber != "" { | ||
| 497 | + query.Where("dividends_returned_order.dividends_returned_order_number = ?", dividendsReturnedOrderNumber) | ||
| 498 | + } | ||
| 499 | + if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { | ||
| 500 | + query.Where("company->>'companyId' = '?'", companyId) | ||
| 501 | + } | ||
| 502 | + if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { | ||
| 503 | + query.Where("org->>'orgId' = '?'", orgId) | ||
| 504 | + } | ||
| 493 | if err := query.First(); err != nil { | 505 | if err := query.First(); err != nil { |
| 494 | if err.Error() == "pg: no rows in result set" { | 506 | if err.Error() == "pg: no rows in result set" { |
| 495 | return nil, fmt.Errorf("分红退货单不存在") | 507 | return nil, fmt.Errorf("分红退货单不存在") |
| @@ -203,6 +203,9 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) | @@ -203,6 +203,9 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{}) | ||
| 203 | return q, nil | 203 | return q, nil |
| 204 | }) | 204 | }) |
| 205 | } | 205 | } |
| 206 | + if orderGoodDividendsStatus, ok := queryOptions["orderGoodDividendsStatus"]; ok && orderGoodDividendsStatus.(int32) != 0 { | ||
| 207 | + query.Where("order_good_dividends_status = ?", orderGoodDividendsStatus) | ||
| 208 | + } | ||
| 206 | if orderGoodIds, ok := queryOptions["orderGoodIds"]; ok && len(orderGoodIds.([]int64)) > 0 { | 209 | if orderGoodIds, ok := queryOptions["orderGoodIds"]; ok && len(orderGoodIds.([]int64)) > 0 { |
| 207 | query.Where("order_good_id IN (?)", pg.In(orderGoodIds)) | 210 | query.Where("order_good_id IN (?)", pg.In(orderGoodIds)) |
| 208 | } | 211 | } |
-
请 注册 或 登录 后发表评论