xinyb
7 天以前 f632e7d7c25d8a86b1f6718f467bfef0d3c09058
提交 | 用户 | age
385e2d 1 package com.yc.crm.custom.service;
X 2
7cf738 3 import com.yc.action.grid.GridUtils;
X 4 import com.yc.crm.clues.entity.T482103Entity;
f632e7 5 import com.yc.crm.custom.entity.T480601Entity;
7cf738 6 import com.yc.service.BaseService;
385e2d 7 import org.springframework.stereotype.Service;
ad7c8d 8 import org.springframework.transaction.annotation.Transactional;
7cf738 9
X 10 import java.util.List;
385e2d 11
X 12 /**
13  * @BelongsProject: eCoWorksV3
14  * @BelongsPackage: com.yc.crm.custom.service
15  * @author: xinyb
16  * @CreateTime: 2024-08-24  14:45
17  * @Description:
18  */
19 @Service
7cf738 20 public class CustomImpl extends BaseService implements CustomIfc {
ad7c8d 21     @Transactional(rollbackFor = Exception.class)
7cf738 22     @Override
f632e7 23     public String saveCustom(T480601Entity custom) {
7cf738 24         String sql = "set nocount on\n";
X 25         try {
26             sql += "declare @docCode varchar(50) \n";
f632e7 27             sql += "exec sp_newdoccode t480601," + GridUtils.prossSqlParm(custom.getEnterCode()) + ",@docCode output \n";
7cf738 28             sql += "insert into t480601H(formId,docDate,periodId,docStatus,companyId,companyName,enterCode,enterName,enterDate," +
X 29                     "postCode,postName,postDate,cltCode,cltName,country,province,city,district,street) " +
30                     "values (" + custom.getFormId() + ",convert(varchar(10),getdate(),120),convert(varchar(7),getdate(),120),0," +
31                     GridUtils.prossSqlParm(custom.getCompanyid()) + "," + GridUtils.prossSqlParm(custom.getCompanyname()) + "," +
32                     GridUtils.prossSqlParm(custom.getEnterCode()) + "," + GridUtils.prossSqlParm(custom.getEnterName()) + ",getdate()," +
33                     GridUtils.prossSqlParm(custom.getEnterCode()) + "," + GridUtils.prossSqlParm(custom.getEnterName()) + ",getdate()," +
34                     "'',''," + GridUtils.prossSqlParm(custom.getCountry()) + "," + GridUtils.prossSqlParm(custom.getProvince()) + "," +
35                     GridUtils.prossSqlParm(custom.getCity()) + "," + GridUtils.prossSqlParm(custom.getDistrict()) + "," +
36                     GridUtils.prossSqlParm(custom.getStreet()) + ") \n";
37             if (custom.getContactsList() != null && custom.getContactsList().size() > 0) {//插入联系人
38                 for (T482103Entity c : custom.getContactsList()) {
39                     sql += "insert into t482103(main_customer_flag,refCode,name,email,gender,post,remark,image_list,birth,post_grade,growth_level,create_time,update_time) " +
40                             "values(" + c.getMainCustomerFlag() + ",@docCode," + GridUtils.prossSqlParm(c.getName()) + "," + GridUtils.prossSqlParm(c.getEmail()) + "," +
41                             GridUtils.prossSqlParm(c.getGender()) + "," + GridUtils.prossSqlParm(c.getPost()) + "," + GridUtils.prossSqlParm(c.getRemark()) + "," +
42                             GridUtils.prossSqlParm(c.getImageList()) + "," + GridUtils.prossSqlParm(c.getBirth()) + "," + GridUtils.prossSqlParm(c.getPostGrade()) + "," +
43                             c.getGrowthLevel() + ",getdate(),getdate()) \n";
44                 }
45             }
46             sql += "select @docCode as docCode";
47             String docCode = jdbcTemplate.queryForObject(sql, String.class);
48             return docCode;
49         } catch (Exception e) {
50             throw e;
51         }
52     }
ad7c8d 53     @Transactional(rollbackFor = Exception.class)
7cf738 54     @Override
f632e7 55     public Integer updateCustom(T480601Entity custom) {
7cf738 56         String sql = "set nocunt on \n";
X 57         try {
58             sql += "update t480601H set modifyCode=" + GridUtils.prossSqlParm(custom.getEnterCode()) + ",modifyName=" + GridUtils.prossSqlParm(custom.getEnterName()) + "," +
59                     "modifyDate=getdate(),country=" + GridUtils.prossSqlParm(custom.getCountry()) + ",province=" + GridUtils.prossSqlParm(custom.getProvince()) + "," +
60                     "city=" + GridUtils.prossSqlParm(custom.getCity()) + ",district=" + GridUtils.prossSqlParm(custom.getDistrict()) + ",street=" + GridUtils.prossSqlParm(custom.getStreet()) +
61                     " where docCode=" + GridUtils.prossSqlParm(custom.getDocCode());
62             sql += "select @@ROWCOUNT \n";
63             return jdbcTemplate.queryForObject(sql, Integer.class);
64         } catch (Exception e) {
65             throw e;
66         }
67     }
ad7c8d 68     @Transactional(rollbackFor = Exception.class)
7cf738 69     @Override
X 70     public Integer deleteCustom(String docCode, String userCode) {
71         String sql = "set nocunt on \n";
72         try {
73             sql += "delete t480601H where docCode=" + GridUtils.prossSqlParm(docCode);
74             sql += "select @@ROWCOUNT \n";
75             return jdbcTemplate.queryForObject(sql, Integer.class);
76         } catch (Exception e) {
77             throw e;
78         }
79     }
80
81     @Override
f632e7 82     public List<T480601Entity> getCustomList(String userCode) {
7cf738 83         try {
X 84             return null;
85         } catch (Exception e) {
86             throw e;
87         }
88     }
89
90     @Override
f632e7 91     public T480601Entity getCustomInfo(String docCode, String userCode) {
7cf738 92         try {
X 93             return null;
94         } catch (Exception e) {
95             throw e;
96         }
97     }
385e2d 98 }