KdYdCustomerLiaisonServiceImpl.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package com.malk.huagao.service.impl;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4. import com.malk.huagao.entity.KdYdCustomer;
  5. import com.malk.huagao.entity.KdYdCustomerLiaison;
  6. import com.malk.huagao.mapper.KdYdCustomerLiaisonMapper;
  7. import com.malk.huagao.mapper.KdYdCustomerMapper;
  8. import com.malk.huagao.service.IKdYdCustomerLiaisonService;
  9. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  10. import com.malk.server.aliwork.YDConf;
  11. import com.malk.server.aliwork.YDParam;
  12. import com.malk.server.dingtalk.DDR_New;
  13. import com.malk.service.aliwork.YDClient;
  14. import com.malk.utils.UtilMap;
  15. import org.slf4j.MDC;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.stereotype.Service;
  18. import java.util.List;
  19. import java.util.Map;
  20. /**
  21. * <p>
  22. * 服务实现类
  23. * </p>
  24. *
  25. * @author LQY
  26. * @since 2025-10-13
  27. */
  28. @Service
  29. public class KdYdCustomerLiaisonServiceImpl extends ServiceImpl<KdYdCustomerLiaisonMapper, KdYdCustomerLiaison> implements IKdYdCustomerLiaisonService {
  30. @Autowired
  31. private YDClient ydClient;
  32. @Autowired
  33. private KdYdCustomerLiaisonMapper kdYdCustomerLiaisonMapper;
  34. @Autowired
  35. private KdYdCustomerMapper kdYdCustomerMapper;
  36. @Override
  37. public void insertCustomerLiaison(Map map) {
  38. MDC.put("MDC_KEY_PID", "1003");
  39. String formInstId = UtilMap.getString(map, "formInstId");
  40. String type = UtilMap.getString(map, "type");
  41. if ("3".equals(type)) {
  42. String bm = UtilMap.getString(map, "bm");
  43. KdYdCustomerLiaison kdYdCustomerLiaison = new KdYdCustomerLiaison();
  44. kdYdCustomerLiaison.setOperationType("3");
  45. kdYdCustomerLiaison.setSyncStatus("0");
  46. kdYdCustomerLiaisonMapper.update(kdYdCustomerLiaison,
  47. new LambdaQueryWrapper<KdYdCustomerLiaison>().eq(KdYdCustomerLiaison::getBm, bm));
  48. return; // 或者根据你的业务逻辑返回相应的结果
  49. }
  50. DDR_New ddrNew = ydClient.queryData(YDParam.builder()
  51. .formInstId(formInstId)
  52. .build(), YDConf.FORM_QUERY.retrieve_id);
  53. Map formData = ddrNew.getFormData();
  54. String xm = UtilMap.getString(formData, "textField_l3s6ubhq");
  55. String bm1 = UtilMap.getString(formData, "serialNumberField_mhk5zwzs");
  56. String zw = UtilMap.getString(formData, "textField_l3s6ubht");
  57. String gddh = UtilMap.getString(formData, "textField_mfxu5dnk");
  58. String yddh = UtilMap.getString(formData, "textField_lqbzc3gq");
  59. String cz = UtilMap.getString(formData, "textField_mfxu5dnl");
  60. String yx = UtilMap.getString(formData, "textField_lqbzc3gr");
  61. String xb = UtilMap.getString(formData, "radioField_l3s6ubhx");
  62. // String customerId = UtilMap.getString(formData, "textField_mgoxa46w");
  63. // String uuid = UtilMap.getString(formData, "textField_mfkp33s5");
  64. String khbh = UtilMap.getString(formData, "textField_mfkks8wx");
  65. LambdaQueryWrapper<KdYdCustomer> YdCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
  66. YdCustomerLambdaQueryWrapper.eq(KdYdCustomer::getKhbm, khbh);
  67. KdYdCustomer kdYdCustomer1 = kdYdCustomerMapper.selectOne(YdCustomerLambdaQueryWrapper);
  68. Long id = kdYdCustomer1.getId();
  69. KdYdCustomerLiaison kdYdCustomerLiaison = new KdYdCustomerLiaison();
  70. kdYdCustomerLiaison.setXm(xm);
  71. kdYdCustomerLiaison.setZw(zw);
  72. kdYdCustomerLiaison.setBm(bm1);
  73. kdYdCustomerLiaison.setGddh(gddh);
  74. kdYdCustomerLiaison.setYddh(yddh);
  75. kdYdCustomerLiaison.setCz(cz);
  76. kdYdCustomerLiaison.setYx(yx);
  77. kdYdCustomerLiaison.setXb(xb);
  78. // kdYdCustomerLiaison.setFormInstId(formInstId);
  79. kdYdCustomerLiaison.setCustomerId(id);
  80. kdYdCustomerLiaison.setSyncStatus("0");
  81. kdYdCustomerLiaison.setOperationType("1");
  82. if ("2".equals(type)) {
  83. kdYdCustomerLiaison.setOperationType(type);
  84. kdYdCustomerLiaisonMapper.update(kdYdCustomerLiaison,
  85. new LambdaQueryWrapper<KdYdCustomerLiaison>().eq(KdYdCustomerLiaison::getBm, bm1));
  86. } else {
  87. this.save(kdYdCustomerLiaison);
  88. }
  89. // ydClient.operateData(
  90. // YDParam.builder()
  91. // .formInstanceId(formInstId)
  92. // .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_mfkks8wx", khbm)))
  93. // .useLatestVersion(true).build(), YDConf.FORM_OPERATION.update);
  94. }
  95. }