diff --git a/src/main/java/com/glxp/api/controller/auth/LoginController.java b/src/main/java/com/glxp/api/controller/auth/LoginController.java index d96233dc..968534f1 100644 --- a/src/main/java/com/glxp/api/controller/auth/LoginController.java +++ b/src/main/java/com/glxp/api/controller/auth/LoginController.java @@ -27,10 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -308,4 +305,44 @@ public class LoginController extends BaseController { return ResultVOUtils.error(ResultEnum.DATA_CHANGE); } + /** + * 平台验证 + * + * @return + */ + @ResponseBody + @PostMapping(value = "/verify") + public BaseResponse verify(@RequestBody Map params, + HttpServletRequest request) { + AuthAdmin authAdmin; + authAdmin = authAdminService.findByUserName(params.get("username").toString()); + if (authAdmin == null) { + throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); + } + + + if (!PasswordUtils.authAdminPwd(params.get("password").toString()).equals(authAdmin.getPassWord())) { + throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); + } + AuthLicense authLicense = new AuthLicense(); + if (params.get("appid") != null) { + authLicense = authLicenseDao.get(params.get("appid").toString()); + } else { + String appid = AppUtils.getAppid(); + authLicense.setId(appid); + authLicense.setAppid(appid); + authLicense.setApiKey(appid); + if (params.get("name") != null) + authLicense.setName(params.get("name").toString()); + authLicense.setSecretKey(AppUtils.getSecretKey(appid)); + authLicense.setCustomerId(authAdmin.getCustomerId() + ""); + CompanyEntity companyEntity = companyService.findCompany(authAdmin.getCustomerId()); + authLicense.setCompanyName(companyEntity.getCompanyName()); + authLicense.setCreateDate(new Date()); + authLicenseDao.romveByCustomerId(authAdmin.getCustomerId() + ""); + authLicenseDao.save(authLicense); + } + return ResultVOUtils.success(authLicense); + } + } diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index f88106b6..0bdadd55 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -614,8 +614,8 @@ public class IoOrderDetailBizController extends BaseController { orderEntity.setUpdateTime(new Date()); orderService.update(orderEntity); } - ioOrderDetailBizEntity.setCheckFileName(ioOrderDetailBizEntity.getFilePath()); - ioOrderDetailBizEntity.setCheckColdFileName(ioOrderDetailBizEntity.getColdFilePath()); + ioOrderDetailBizEntity.setCheckFileName(ioOrderDetailBizEntity.getCheckFileName()); + ioOrderDetailBizEntity.setCheckColdFileName(ioOrderDetailBizEntity.getCheckColdFileName()); boolean b = orderDetailBizService.updateOrderDetailBiz(ioOrderDetailBizEntity); return ResultVOUtils.success("修改成功!"); } diff --git a/src/main/java/com/glxp/api/controller/inv/InvProductController.java b/src/main/java/com/glxp/api/controller/inv/InvProductController.java index 178b31e8..d090418d 100644 --- a/src/main/java/com/glxp/api/controller/inv/InvProductController.java +++ b/src/main/java/com/glxp/api/controller/inv/InvProductController.java @@ -147,16 +147,16 @@ public class InvProductController extends BaseController { } //根据单据日期排序 - list.sort((o1, o2) -> { - long o1OrderTime = DateUtil.parseDate(o1.getOrderTime()).getTime(); - long o2OrderTime = DateUtil.parseDate(o2.getOrderTime()).getTime(); - if (o1OrderTime > o2OrderTime) { - return 1; - } else if (o1OrderTime < o2OrderTime) { - return -1; - } - return 0; - }); +// list.sort((o1, o2) -> { +// long o1OrderTime = DateUtil.parseDate(o1.getOrderTime()).getTime(); +// long o2OrderTime = DateUtil.parseDate(o2.getOrderTime()).getTime(); +// if (o1OrderTime > o2OrderTime) { +// return 1; +// } else if (o1OrderTime < o2OrderTime) { +// return -1; +// } +// return 0; +// }); PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setTotal(pageInfo.getTotal()); diff --git a/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java b/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java index efbee6f7..f165e2e2 100644 --- a/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java +++ b/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java @@ -204,11 +204,12 @@ public class PurOrderController { ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh()); ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc()); ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory()); + ioOrderDetailBizEntity.setPrice(obj.getPrice()); ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname()); ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh()); - if (basicProductsEntity.getPrice() != null) { - ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice())); - } +// if (basicProductsEntity.getPrice() != null) { +// ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice())); +// } ioOrderDetailBizEntity.setSupId(obj.getSupId()); ioOrderDetailBizService.insert(ioOrderDetailBizEntity); } @@ -299,11 +300,6 @@ public class PurOrderController { } - public void genOrder() { - - } - - /** * 查询采购订单列表 */ diff --git a/src/main/java/com/glxp/api/entity/purchase/PurOrderDetailEntity.java b/src/main/java/com/glxp/api/entity/purchase/PurOrderDetailEntity.java index 50a0b4b4..914bc521 100644 --- a/src/main/java/com/glxp/api/entity/purchase/PurOrderDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/purchase/PurOrderDetailEntity.java @@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import java.math.BigDecimal; + @Data @TableName(value = "pur_order_detail") public class PurOrderDetailEntity { @@ -48,6 +50,10 @@ public class PurOrderDetailEntity { @TableField(value = "zczbhhzbapzbh") private String zczbhhzbapzbh; + + @TableField(value = "price") + private BigDecimal price; + public static final String COL_ID = "id"; public static final String COL_ORDERIDFK = "orderIdFk"; diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java b/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java index 165dd73f..c6d65f66 100644 --- a/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java +++ b/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java @@ -241,7 +241,6 @@ public class IoOrderResponse { private BigDecimal allAmount; - /** * 校验信息 */ @@ -256,10 +255,11 @@ public class IoOrderResponse { public String getFromName() { - if (StrUtil.isNotEmpty(fromCorpName)) - return fromCorpName; + if (StrUtil.isNotEmpty(fromInvName)) return fromInvName; + if (StrUtil.isNotEmpty(fromCorpName)) + return fromCorpName; return fromName; } } diff --git a/src/main/java/com/glxp/api/res/purchase/PurOrderDetailResponse.java b/src/main/java/com/glxp/api/res/purchase/PurOrderDetailResponse.java index c4c2f2c6..c15e3796 100644 --- a/src/main/java/com/glxp/api/res/purchase/PurOrderDetailResponse.java +++ b/src/main/java/com/glxp/api/res/purchase/PurOrderDetailResponse.java @@ -48,4 +48,7 @@ public class PurOrderDetailResponse { private String supId; private String supName; + + private String billNo; + private String nameCode; } diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index ffff4c70..6748597f 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -257,6 +257,17 @@ public class IoChangeInoutService { codeTempEntities.add(codeTempEntity); } codeTempService.insertBatch(codeTempEntities); + + // 生成业务单 + List orderDetailBizEntities = orderDetailBizService.findByOrderId(orderEntity.getBillNo()); + if (CollUtil.isNotEmpty(orderDetailBizEntities)) { + for (IoOrderDetailBizEntity orderDetailBizEntity : orderDetailBizEntities) { + orderDetailBizEntity.setOrderIdFk(outOrder.getBillNo()); + orderDetailBizEntity.setId(IdUtil.getSnowflakeNextId()); + orderDetailBizService.insert(orderDetailBizEntity); + } + } + if (isGenInovice) { //生成发票信息 List invoiceEntities = ioOrderInvoiceService.findByBillNo(orderEntity.getBillNo()); diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index ecf3d52e..9a5dfe02 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -290,8 +290,10 @@ public class IoCheckInoutService { orderService.update(orderEntity); return; } - - orderDetailBizService.deleteByOrderId(orderEntity.getBillNo()); + if (orderEntity.getFromType() != ConstantStatus.FROM_COPY + && orderEntity.getFromType() != ConstantStatus.FROM_CHANGE) { + orderDetailBizService.deleteByOrderId(orderEntity.getBillNo()); + } orderDetailResultService.deleteByOrderId(orderEntity.getBillNo()); orderDetailCodeEntities.forEach(orderDetailCodeEntity -> { diff --git a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java index 31000958..fb6a2e68 100644 --- a/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java +++ b/src/main/java/com/glxp/api/service/sync/SpsSyncDownloadService.java @@ -382,7 +382,7 @@ public class SpsSyncDownloadService { Map map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.SUP_CERT, createFile); totalTimeMap.put(BasicExportStatusTimeEnum.SUP_CERT, map); List supCertList = supCertService.list(Wrappers.lambdaQuery(SupCertEntity.class) - .eq(SupCertEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) + .ge(SupCertEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .le(!ge && (boolean) map.get("isNew"), SupCertEntity::getUpdateTime, now) .between(ge, SupCertEntity::getUpdateTime, syncTime, now) .between(!ge && !(boolean) map.get("isNew"), SupCertEntity::getUpdateTime @@ -392,7 +392,8 @@ public class SpsSyncDownloadService { jsonMap.put(SupCertEntity.class.getSimpleName(), supCertList); for (SupCertEntity supCertEntity : supCertList) { if (StrUtil.isNotEmpty(supCertEntity.getFilePath())) { - syncFiles.add(supCertEntity.getFilePath()); + String[] fileNames = supCertEntity.getFilePath().split(","); + syncFiles.addAll(CollUtil.toList(fileNames)); } } if (CollUtil.isNotEmpty(syncFiles)) { @@ -410,7 +411,7 @@ public class SpsSyncDownloadService { jsonMap.put(SupCertSetEntity.class.getSimpleName(), supCertSetList); } List supCompanyList = supCompanyService.list(Wrappers.lambdaQuery(SupCompanyEntity.class) - .eq(SupCompanyEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) + .ge(SupCompanyEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .le(!ge && (boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime, now) .between(ge, SupCompanyEntity::getUpdateTime, syncTime, now) .between(!ge && !(boolean) map.get("isNew"), SupCompanyEntity::getUpdateTime @@ -421,7 +422,7 @@ public class SpsSyncDownloadService { jsonMap.put(SupCompanyEntity.class.getSimpleName(), supCompanyList); } List supManufacturerList = supManufacturerService.list(Wrappers.lambdaQuery(SupManufacturerEntity.class) - .eq(SupManufacturerEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) + .ge(SupManufacturerEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .le(!ge && (boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime, now) .between(ge, SupManufacturerEntity::getUpdateTime, syncTime, now) .between(!ge && !(boolean) map.get("isNew"), SupManufacturerEntity::getUpdateTime @@ -432,7 +433,7 @@ public class SpsSyncDownloadService { jsonMap.put(SupManufacturerEntity.class.getSimpleName(), supManufacturerList); } List supProductList = supProductService.list(Wrappers.lambdaQuery(SupProductEntity.class) - .eq(SupProductEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) + .ge(SupProductEntity::getAuditStatus, ConstantStatus.AUDIT_PASS) .le(!ge && (boolean) map.get("isNew"), SupProductEntity::getUpdateTime, now) .between(ge, SupProductEntity::getUpdateTime, syncTime, now) .between(!ge && !(boolean) map.get("isNew"), SupProductEntity::getUpdateTime @@ -876,8 +877,13 @@ public class SpsSyncDownloadService { if (CollUtil.isNotEmpty(bizEntities)) { orderDetailBizEntities.addAll(bizEntities); for (IoOrderDetailBizEntity bizEntity : bizEntities) { - if (StrUtil.isNotEmpty(bizEntity.getCheckFileName())) { - syncFiles.add(bizEntity.getCheckFileName()); + if (StrUtil.isNotEmpty(bizEntity.getFilePath())) { + String[] fileNames = bizEntity.getFilePath().split(","); + syncFiles.addAll(CollUtil.toList(fileNames)); + } + if (StrUtil.isNotEmpty(bizEntity.getColdFilePath())) { + String[] fileNames = bizEntity.getColdFilePath().split(","); + syncFiles.addAll(CollUtil.toList(fileNames)); } } } diff --git a/src/main/java/com/glxp/api/util/AppUtils.java b/src/main/java/com/glxp/api/util/AppUtils.java new file mode 100644 index 00000000..79b5c30f --- /dev/null +++ b/src/main/java/com/glxp/api/util/AppUtils.java @@ -0,0 +1,63 @@ +package com.glxp.api.util; + +import lombok.extern.slf4j.Slf4j; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.UUID; + +@Slf4j +public class AppUtils { + //生成secret_key + private final static String SALT = "1qazxsw2"; + private static final String ALGORITH_NAME = "sha-512"; + private static final int HASH_ITERATIONS = 2; + private final static String[] CHARS = new String[]{"a", "b", "c", "d", "e", "f", + "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", + "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", + "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", + "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", + "t", "u", "v", "w", "x", "y", "z"}; + + public static String getAppid() { + StringBuffer shortBuffer = new StringBuffer(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + for (int i = 0; i < 8; i++) { + String str = uuid.substring(i * 4, i * 4 + 4); + int x = Integer.parseInt(str, 16); + shortBuffer.append(CHARS[x % 0x3E]); + } + return shortBuffer.toString(); + } + + public static String getSecretKey(String appid) { + try { + String[] array = new String[]{appid, SALT}; + StringBuilder sb = new StringBuilder(); + + Arrays.sort(array); + for (String s : array) { + sb.append(s); + } + String str = sb.toString(); + MessageDigest md = MessageDigest.getInstance("SHA-1"); + md.update(str.getBytes()); + byte[] digest = md.digest(); + + StringBuilder hexstr = new StringBuilder(); + String shaHex = ""; + for (byte b : digest) { + shaHex = Integer.toHexString(b & 0xFF); + if (shaHex.length() < 2) { + hexstr.append(0); + } + hexstr.append(shaHex); + } + return hexstr.toString(); + } catch (NoSuchAlgorithmException e) { + log.error(e.getMessage(), e); + throw new RuntimeException(); + } + } +} \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index c2a962d2..eed086a0 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,7 +3,7 @@ server: spring: datasource: driver-class-name: com.p6spy.engine.spy.P6SpyDriver - jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_spms_pt?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true + jdbc-url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_spms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true username: root password: 123456 hikari: diff --git a/src/main/resources/mybatis/mapper/basic/BasicBussinessTypeDao.xml b/src/main/resources/mybatis/mapper/basic/BasicBussinessTypeDao.xml index 19ba6662..58b9a21a 100644 --- a/src/main/resources/mybatis/mapper/basic/BasicBussinessTypeDao.xml +++ b/src/main/resources/mybatis/mapper/basic/BasicBussinessTypeDao.xml @@ -73,7 +73,7 @@ thrCheckPdaUn, thrCheckPdaEd, thrCheckUdims, thrCheckPc, thrCheckSp, thrCheckChange, thrCheckBalance, thrCheckCopy, fillCodeRel, checkVailDate, checkExpire, checkCertExpire, preInBackAction, backPreinType, checkPreInOrders, - sortNum,spaceOut) + sortNum, spaceOut) values (#{mainAction}, #{action}, #{name}, #{enable}, #{remark}, #{thirdSysFk}, #{genUnit}, #{innerOrder}, #{secCheckEnable}, #{checkEnable}, #{checkUdims}, #{checkPdaEd}, #{checkPdaUn}, #{checkPc}, #{checkWebNew}, #{checkSp}, #{checkChange}, #{secCheckUdims}, #{secCheckPdaEd}, #{secCheckPdaUn}, @@ -86,7 +86,7 @@ #{thrCheckPdaUn}, #{thrCheckPdaEd}, #{thrCheckUdims}, #{thrCheckPc}, #{thrCheckSp}, #{thrCheckChange}, #{thrCheckBalance}, #{thrCheckCopy}, #{fillCodeRel}, #{checkVailDate}, #{checkExpire}, #{checkCertExpire}, #{preInBackAction}, #{backPreinType}, #{checkPreInOrders}, - #{sortNum},#{spaceOut}) + #{sortNum}, #{spaceOut}) SELECT pur_order_detail.*, - basic_products.ggxh spec, + basic_products.ggxh spec, + basic_products.nameCode nameCode, basic_products.measname, basic_products.manufactory, basic_products.ylqxzcrbarmc, - basic_corp.`name` supName + basic_corp.`name` supName FROM pur_order_detail left JOIN basic_udirel ON pur_order_detail.productId = basic_udirel.id left JOIN basic_products ON basic_udirel.uuid = basic_products.uuid @@ -98,6 +99,9 @@ zczbhhzbapzbh=#{zczbhhzbapzbh}, + + price=#{price}, + WHERE id = #{id} @@ -106,7 +110,7 @@ REPLACE INTO pur_order_detail - (orderIdFk, productId, productName, count, supId, zczbhhzbapzbh) values + (orderIdFk, productId, productName, count, supId, zczbhhzbapzbh, price) values (#{item.orderIdFk}, @@ -114,7 +118,7 @@ #{item.productName}, #{item.count}, #{item.supId}, - #{item.zczbhhzbapzbh}) + #{item.zczbhhzbapzbh}, #{item.price}) diff --git a/src/main/resources/schemas/schema_v2.1.sql b/src/main/resources/schemas/schema_v2.1.sql index 3b6f34c7..38a344d9 100644 --- a/src/main/resources/schemas/schema_v2.1.sql +++ b/src/main/resources/schemas/schema_v2.1.sql @@ -383,6 +383,8 @@ CALL Pro_Temp_ColumnWork('io_order_detail_biz', 'id', 'bigint ', 2); CALL Pro_Temp_ColumnWork('io_order_invoice', 'bizIdFk', 'bigint ', 2); +CALL Pro_Temp_ColumnWork('pur_order_detail', 'price', 'decimal(10, 2)', 1); +